1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22
23#if ENABLE(WEB_RTC)
24
25#include "JSRTCStatsReport.h"
26
27#include "ActiveDOMObject.h"
28#include "DOMIsoSubspaces.h"
29#include "JSDOMAttribute.h"
30#include "JSDOMBinding.h"
31#include "JSDOMConstructorNotConstructable.h"
32#include "JSDOMConvertAny.h"
33#include "JSDOMConvertBoolean.h"
34#include "JSDOMConvertNumbers.h"
35#include "JSDOMConvertStrings.h"
36#include "JSDOMExceptionHandling.h"
37#include "JSDOMGlobalObject.h"
38#include "JSDOMGlobalObjectInlines.h"
39#include "JSDOMMapLike.h"
40#include "JSDOMOperation.h"
41#include "JSDOMWrapperCache.h"
42#include "JSRTCIceCandidateType.h"
43#include "ScriptExecutionContext.h"
44#include "WebCoreJSClientData.h"
45#include <JavaScriptCore/BuiltinNames.h>
46#include <JavaScriptCore/FunctionPrototype.h>
47#include <JavaScriptCore/HeapAnalyzer.h>
48#include <JavaScriptCore/JSCInlines.h>
49#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h>
50#include <JavaScriptCore/JSString.h>
51#include <JavaScriptCore/ObjectConstructor.h>
52#include <JavaScriptCore/SlotVisitorMacros.h>
53#include <JavaScriptCore/SubspaceInlines.h>
54#include <wtf/GetPtr.h>
55#include <wtf/PointerPreparations.h>
56#include <wtf/URL.h>
57
58
59namespace WebCore {
60using namespace JSC;
61
62String convertEnumerationToString(RTCStatsReport::Type enumerationValue)
63{
64 static const NeverDestroyed<String> values[] = {
65 MAKE_STATIC_STRING_IMPL("candidate-pair"),
66 MAKE_STATIC_STRING_IMPL("certificate"),
67 MAKE_STATIC_STRING_IMPL("codec"),
68 MAKE_STATIC_STRING_IMPL("data-channel"),
69 MAKE_STATIC_STRING_IMPL("inbound-rtp"),
70 MAKE_STATIC_STRING_IMPL("local-candidate"),
71 MAKE_STATIC_STRING_IMPL("media-source"),
72 MAKE_STATIC_STRING_IMPL("outbound-rtp"),
73 MAKE_STATIC_STRING_IMPL("peer-connection"),
74 MAKE_STATIC_STRING_IMPL("remote-candidate"),
75 MAKE_STATIC_STRING_IMPL("remote-inbound-rtp"),
76 MAKE_STATIC_STRING_IMPL("track"),
77 MAKE_STATIC_STRING_IMPL("transport"),
78 };
79 static_assert(static_cast<size_t>(RTCStatsReport::Type::CandidatePair) == 0, "RTCStatsReport::Type::CandidatePair is not 0 as expected");
80 static_assert(static_cast<size_t>(RTCStatsReport::Type::Certificate) == 1, "RTCStatsReport::Type::Certificate is not 1 as expected");
81 static_assert(static_cast<size_t>(RTCStatsReport::Type::Codec) == 2, "RTCStatsReport::Type::Codec is not 2 as expected");
82 static_assert(static_cast<size_t>(RTCStatsReport::Type::DataChannel) == 3, "RTCStatsReport::Type::DataChannel is not 3 as expected");
83 static_assert(static_cast<size_t>(RTCStatsReport::Type::InboundRtp) == 4, "RTCStatsReport::Type::InboundRtp is not 4 as expected");
84 static_assert(static_cast<size_t>(RTCStatsReport::Type::LocalCandidate) == 5, "RTCStatsReport::Type::LocalCandidate is not 5 as expected");
85 static_assert(static_cast<size_t>(RTCStatsReport::Type::MediaSource) == 6, "RTCStatsReport::Type::MediaSource is not 6 as expected");
86 static_assert(static_cast<size_t>(RTCStatsReport::Type::OutboundRtp) == 7, "RTCStatsReport::Type::OutboundRtp is not 7 as expected");
87 static_assert(static_cast<size_t>(RTCStatsReport::Type::PeerConnection) == 8, "RTCStatsReport::Type::PeerConnection is not 8 as expected");
88 static_assert(static_cast<size_t>(RTCStatsReport::Type::RemoteCandidate) == 9, "RTCStatsReport::Type::RemoteCandidate is not 9 as expected");
89 static_assert(static_cast<size_t>(RTCStatsReport::Type::RemoteInboundRtp) == 10, "RTCStatsReport::Type::RemoteInboundRtp is not 10 as expected");
90 static_assert(static_cast<size_t>(RTCStatsReport::Type::Track) == 11, "RTCStatsReport::Type::Track is not 11 as expected");
91 static_assert(static_cast<size_t>(RTCStatsReport::Type::Transport) == 12, "RTCStatsReport::Type::Transport is not 12 as expected");
92 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
93 return values[static_cast<size_t>(enumerationValue)];
94}
95
96template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, RTCStatsReport::Type enumerationValue)
97{
98 return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue));
99}
100
101template<> std::optional<RTCStatsReport::Type> parseEnumeration<RTCStatsReport::Type>(JSGlobalObject& lexicalGlobalObject, JSValue value)
102{
103 auto stringValue = value.toWTFString(&lexicalGlobalObject);
104 if (stringValue == "candidate-pair")
105 return RTCStatsReport::Type::CandidatePair;
106 if (stringValue == "certificate")
107 return RTCStatsReport::Type::Certificate;
108 if (stringValue == "codec")
109 return RTCStatsReport::Type::Codec;
110 if (stringValue == "data-channel")
111 return RTCStatsReport::Type::DataChannel;
112 if (stringValue == "inbound-rtp")
113 return RTCStatsReport::Type::InboundRtp;
114 if (stringValue == "local-candidate")
115 return RTCStatsReport::Type::LocalCandidate;
116 if (stringValue == "media-source")
117 return RTCStatsReport::Type::MediaSource;
118 if (stringValue == "outbound-rtp")
119 return RTCStatsReport::Type::OutboundRtp;
120 if (stringValue == "peer-connection")
121 return RTCStatsReport::Type::PeerConnection;
122 if (stringValue == "remote-candidate")
123 return RTCStatsReport::Type::RemoteCandidate;
124 if (stringValue == "remote-inbound-rtp")
125 return RTCStatsReport::Type::RemoteInboundRtp;
126 if (stringValue == "track")
127 return RTCStatsReport::Type::Track;
128 if (stringValue == "transport")
129 return RTCStatsReport::Type::Transport;
130 return std::nullopt;
131}
132
133template<> const char* expectedEnumerationValues<RTCStatsReport::Type>()
134{
135 return "\"candidate-pair\", \"certificate\", \"codec\", \"data-channel\", \"inbound-rtp\", \"local-candidate\", \"media-source\", \"outbound-rtp\", \"peer-connection\", \"remote-candidate\", \"remote-inbound-rtp\", \"track\", \"transport\"";
136}
137
138String convertEnumerationToString(RTCStatsReport::IceCandidatePairState enumerationValue)
139{
140 static const NeverDestroyed<String> values[] = {
141 MAKE_STATIC_STRING_IMPL("frozen"),
142 MAKE_STATIC_STRING_IMPL("waiting"),
143 MAKE_STATIC_STRING_IMPL("inprogress"),
144 MAKE_STATIC_STRING_IMPL("failed"),
145 MAKE_STATIC_STRING_IMPL("succeeded"),
146 MAKE_STATIC_STRING_IMPL("cancelled"),
147 };
148 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Frozen) == 0, "RTCStatsReport::IceCandidatePairState::Frozen is not 0 as expected");
149 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Waiting) == 1, "RTCStatsReport::IceCandidatePairState::Waiting is not 1 as expected");
150 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Inprogress) == 2, "RTCStatsReport::IceCandidatePairState::Inprogress is not 2 as expected");
151 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Failed) == 3, "RTCStatsReport::IceCandidatePairState::Failed is not 3 as expected");
152 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Succeeded) == 4, "RTCStatsReport::IceCandidatePairState::Succeeded is not 4 as expected");
153 static_assert(static_cast<size_t>(RTCStatsReport::IceCandidatePairState::Cancelled) == 5, "RTCStatsReport::IceCandidatePairState::Cancelled is not 5 as expected");
154 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
155 return values[static_cast<size_t>(enumerationValue)];
156}
157
158template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, RTCStatsReport::IceCandidatePairState enumerationValue)
159{
160 return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue));
161}
162
163template<> std::optional<RTCStatsReport::IceCandidatePairState> parseEnumeration<RTCStatsReport::IceCandidatePairState>(JSGlobalObject& lexicalGlobalObject, JSValue value)
164{
165 auto stringValue = value.toWTFString(&lexicalGlobalObject);
166 if (stringValue == "frozen")
167 return RTCStatsReport::IceCandidatePairState::Frozen;
168 if (stringValue == "waiting")
169 return RTCStatsReport::IceCandidatePairState::Waiting;
170 if (stringValue == "inprogress")
171 return RTCStatsReport::IceCandidatePairState::Inprogress;
172 if (stringValue == "failed")
173 return RTCStatsReport::IceCandidatePairState::Failed;
174 if (stringValue == "succeeded")
175 return RTCStatsReport::IceCandidatePairState::Succeeded;
176 if (stringValue == "cancelled")
177 return RTCStatsReport::IceCandidatePairState::Cancelled;
178 return std::nullopt;
179}
180
181template<> const char* expectedEnumerationValues<RTCStatsReport::IceCandidatePairState>()
182{
183 return "\"frozen\", \"waiting\", \"inprogress\", \"failed\", \"succeeded\", \"cancelled\"";
184}
185
186String convertEnumerationToString(RTCStatsReport::CodecType enumerationValue)
187{
188 static const NeverDestroyed<String> values[] = {
189 MAKE_STATIC_STRING_IMPL("encode"),
190 MAKE_STATIC_STRING_IMPL("decode"),
191 };
192 static_assert(static_cast<size_t>(RTCStatsReport::CodecType::Encode) == 0, "RTCStatsReport::CodecType::Encode is not 0 as expected");
193 static_assert(static_cast<size_t>(RTCStatsReport::CodecType::Decode) == 1, "RTCStatsReport::CodecType::Decode is not 1 as expected");
194 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
195 return values[static_cast<size_t>(enumerationValue)];
196}
197
198template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, RTCStatsReport::CodecType enumerationValue)
199{
200 return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue));
201}
202
203template<> std::optional<RTCStatsReport::CodecType> parseEnumeration<RTCStatsReport::CodecType>(JSGlobalObject& lexicalGlobalObject, JSValue value)
204{
205 auto stringValue = value.toWTFString(&lexicalGlobalObject);
206 if (stringValue == "encode")
207 return RTCStatsReport::CodecType::Encode;
208 if (stringValue == "decode")
209 return RTCStatsReport::CodecType::Decode;
210 return std::nullopt;
211}
212
213template<> const char* expectedEnumerationValues<RTCStatsReport::CodecType>()
214{
215 return "\"encode\", \"decode\"";
216}
217
218template<> RTCStatsReport::Stats convertDictionary<RTCStatsReport::Stats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
219{
220 VM& vm = JSC::getVM(&lexicalGlobalObject);
221 auto throwScope = DECLARE_THROW_SCOPE(vm);
222 bool isNullOrUndefined = value.isUndefinedOrNull();
223 auto* object = isNullOrUndefined ? nullptr : value.getObject();
224 if (UNLIKELY(!isNullOrUndefined && !object)) {
225 throwTypeError(&lexicalGlobalObject, throwScope);
226 return { };
227 }
228 RTCStatsReport::Stats result;
229 JSValue idValue;
230 if (isNullOrUndefined)
231 idValue = jsUndefined();
232 else {
233 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
234 RETURN_IF_EXCEPTION(throwScope, { });
235 }
236 if (!idValue.isUndefined()) {
237 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
238 RETURN_IF_EXCEPTION(throwScope, { });
239 }
240 JSValue timestampValue;
241 if (isNullOrUndefined)
242 timestampValue = jsUndefined();
243 else {
244 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
245 RETURN_IF_EXCEPTION(throwScope, { });
246 }
247 if (!timestampValue.isUndefined()) {
248 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
249 RETURN_IF_EXCEPTION(throwScope, { });
250 }
251 JSValue typeValue;
252 if (isNullOrUndefined)
253 typeValue = jsUndefined();
254 else {
255 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
256 RETURN_IF_EXCEPTION(throwScope, { });
257 }
258 if (!typeValue.isUndefined()) {
259 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
260 RETURN_IF_EXCEPTION(throwScope, { });
261 }
262 return result;
263}
264
265template<> RTCStatsReport::RtpStreamStats convertDictionary<RTCStatsReport::RtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
266{
267 VM& vm = JSC::getVM(&lexicalGlobalObject);
268 auto throwScope = DECLARE_THROW_SCOPE(vm);
269 bool isNullOrUndefined = value.isUndefinedOrNull();
270 auto* object = isNullOrUndefined ? nullptr : value.getObject();
271 if (UNLIKELY(!isNullOrUndefined && !object)) {
272 throwTypeError(&lexicalGlobalObject, throwScope);
273 return { };
274 }
275 RTCStatsReport::RtpStreamStats result;
276 JSValue idValue;
277 if (isNullOrUndefined)
278 idValue = jsUndefined();
279 else {
280 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
281 RETURN_IF_EXCEPTION(throwScope, { });
282 }
283 if (!idValue.isUndefined()) {
284 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
285 RETURN_IF_EXCEPTION(throwScope, { });
286 }
287 JSValue timestampValue;
288 if (isNullOrUndefined)
289 timestampValue = jsUndefined();
290 else {
291 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
292 RETURN_IF_EXCEPTION(throwScope, { });
293 }
294 if (!timestampValue.isUndefined()) {
295 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
296 RETURN_IF_EXCEPTION(throwScope, { });
297 }
298 JSValue typeValue;
299 if (isNullOrUndefined)
300 typeValue = jsUndefined();
301 else {
302 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
303 RETURN_IF_EXCEPTION(throwScope, { });
304 }
305 if (!typeValue.isUndefined()) {
306 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
307 RETURN_IF_EXCEPTION(throwScope, { });
308 }
309 JSValue codecIdValue;
310 if (isNullOrUndefined)
311 codecIdValue = jsUndefined();
312 else {
313 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
314 RETURN_IF_EXCEPTION(throwScope, { });
315 }
316 if (!codecIdValue.isUndefined()) {
317 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
318 RETURN_IF_EXCEPTION(throwScope, { });
319 }
320 JSValue kindValue;
321 if (isNullOrUndefined)
322 kindValue = jsUndefined();
323 else {
324 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
325 RETURN_IF_EXCEPTION(throwScope, { });
326 }
327 if (!kindValue.isUndefined()) {
328 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
329 RETURN_IF_EXCEPTION(throwScope, { });
330 } else {
331 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCRtpStreamStats", "DOMString");
332 return { };
333 }
334 JSValue mediaTypeValue;
335 if (isNullOrUndefined)
336 mediaTypeValue = jsUndefined();
337 else {
338 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
339 RETURN_IF_EXCEPTION(throwScope, { });
340 }
341 if (!mediaTypeValue.isUndefined()) {
342 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
343 RETURN_IF_EXCEPTION(throwScope, { });
344 } else {
345 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCRtpStreamStats", "DOMString");
346 return { };
347 }
348 JSValue ssrcValue;
349 if (isNullOrUndefined)
350 ssrcValue = jsUndefined();
351 else {
352 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
353 RETURN_IF_EXCEPTION(throwScope, { });
354 }
355 if (!ssrcValue.isUndefined()) {
356 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
357 RETURN_IF_EXCEPTION(throwScope, { });
358 } else {
359 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCRtpStreamStats", "unsigned long");
360 return { };
361 }
362 JSValue transportIdValue;
363 if (isNullOrUndefined)
364 transportIdValue = jsUndefined();
365 else {
366 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
367 RETURN_IF_EXCEPTION(throwScope, { });
368 }
369 if (!transportIdValue.isUndefined()) {
370 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
371 RETURN_IF_EXCEPTION(throwScope, { });
372 }
373 return result;
374}
375
376JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::RtpStreamStats& dictionary)
377{
378 auto& vm = JSC::getVM(&lexicalGlobalObject);
379 auto throwScope = DECLARE_THROW_SCOPE(vm);
380
381 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
382
383 if (!IDLDOMString::isNullValue(dictionary.id)) {
384 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
385 RETURN_IF_EXCEPTION(throwScope, { });
386 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
387 }
388 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
389 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
390 RETURN_IF_EXCEPTION(throwScope, { });
391 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
392 }
393 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
394 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
395 RETURN_IF_EXCEPTION(throwScope, { });
396 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
397 }
398 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
399 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
400 RETURN_IF_EXCEPTION(throwScope, { });
401 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
402 }
403 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
404 RETURN_IF_EXCEPTION(throwScope, { });
405 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
406 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
407 RETURN_IF_EXCEPTION(throwScope, { });
408 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
409 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
410 RETURN_IF_EXCEPTION(throwScope, { });
411 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
412 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
413 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
414 RETURN_IF_EXCEPTION(throwScope, { });
415 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
416 }
417 return result;
418}
419
420template<> RTCStatsReport::ReceivedRtpStreamStats convertDictionary<RTCStatsReport::ReceivedRtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
421{
422 VM& vm = JSC::getVM(&lexicalGlobalObject);
423 auto throwScope = DECLARE_THROW_SCOPE(vm);
424 bool isNullOrUndefined = value.isUndefinedOrNull();
425 auto* object = isNullOrUndefined ? nullptr : value.getObject();
426 if (UNLIKELY(!isNullOrUndefined && !object)) {
427 throwTypeError(&lexicalGlobalObject, throwScope);
428 return { };
429 }
430 RTCStatsReport::ReceivedRtpStreamStats result;
431 JSValue idValue;
432 if (isNullOrUndefined)
433 idValue = jsUndefined();
434 else {
435 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
436 RETURN_IF_EXCEPTION(throwScope, { });
437 }
438 if (!idValue.isUndefined()) {
439 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
440 RETURN_IF_EXCEPTION(throwScope, { });
441 }
442 JSValue timestampValue;
443 if (isNullOrUndefined)
444 timestampValue = jsUndefined();
445 else {
446 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
447 RETURN_IF_EXCEPTION(throwScope, { });
448 }
449 if (!timestampValue.isUndefined()) {
450 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
451 RETURN_IF_EXCEPTION(throwScope, { });
452 }
453 JSValue typeValue;
454 if (isNullOrUndefined)
455 typeValue = jsUndefined();
456 else {
457 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
458 RETURN_IF_EXCEPTION(throwScope, { });
459 }
460 if (!typeValue.isUndefined()) {
461 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
462 RETURN_IF_EXCEPTION(throwScope, { });
463 }
464 JSValue codecIdValue;
465 if (isNullOrUndefined)
466 codecIdValue = jsUndefined();
467 else {
468 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
469 RETURN_IF_EXCEPTION(throwScope, { });
470 }
471 if (!codecIdValue.isUndefined()) {
472 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
473 RETURN_IF_EXCEPTION(throwScope, { });
474 }
475 JSValue kindValue;
476 if (isNullOrUndefined)
477 kindValue = jsUndefined();
478 else {
479 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
480 RETURN_IF_EXCEPTION(throwScope, { });
481 }
482 if (!kindValue.isUndefined()) {
483 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
484 RETURN_IF_EXCEPTION(throwScope, { });
485 } else {
486 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCReceivedRtpStreamStats", "DOMString");
487 return { };
488 }
489 JSValue mediaTypeValue;
490 if (isNullOrUndefined)
491 mediaTypeValue = jsUndefined();
492 else {
493 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
494 RETURN_IF_EXCEPTION(throwScope, { });
495 }
496 if (!mediaTypeValue.isUndefined()) {
497 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
498 RETURN_IF_EXCEPTION(throwScope, { });
499 } else {
500 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCReceivedRtpStreamStats", "DOMString");
501 return { };
502 }
503 JSValue ssrcValue;
504 if (isNullOrUndefined)
505 ssrcValue = jsUndefined();
506 else {
507 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
508 RETURN_IF_EXCEPTION(throwScope, { });
509 }
510 if (!ssrcValue.isUndefined()) {
511 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
512 RETURN_IF_EXCEPTION(throwScope, { });
513 } else {
514 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCReceivedRtpStreamStats", "unsigned long");
515 return { };
516 }
517 JSValue transportIdValue;
518 if (isNullOrUndefined)
519 transportIdValue = jsUndefined();
520 else {
521 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
522 RETURN_IF_EXCEPTION(throwScope, { });
523 }
524 if (!transportIdValue.isUndefined()) {
525 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
526 RETURN_IF_EXCEPTION(throwScope, { });
527 }
528 JSValue burstDiscardCountValue;
529 if (isNullOrUndefined)
530 burstDiscardCountValue = jsUndefined();
531 else {
532 burstDiscardCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardCount"));
533 RETURN_IF_EXCEPTION(throwScope, { });
534 }
535 if (!burstDiscardCountValue.isUndefined()) {
536 result.burstDiscardCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstDiscardCountValue);
537 RETURN_IF_EXCEPTION(throwScope, { });
538 }
539 JSValue burstDiscardRateValue;
540 if (isNullOrUndefined)
541 burstDiscardRateValue = jsUndefined();
542 else {
543 burstDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardRate"));
544 RETURN_IF_EXCEPTION(throwScope, { });
545 }
546 if (!burstDiscardRateValue.isUndefined()) {
547 result.burstDiscardRate = convert<IDLDouble>(lexicalGlobalObject, burstDiscardRateValue);
548 RETURN_IF_EXCEPTION(throwScope, { });
549 }
550 JSValue burstLossCountValue;
551 if (isNullOrUndefined)
552 burstLossCountValue = jsUndefined();
553 else {
554 burstLossCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossCount"));
555 RETURN_IF_EXCEPTION(throwScope, { });
556 }
557 if (!burstLossCountValue.isUndefined()) {
558 result.burstLossCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstLossCountValue);
559 RETURN_IF_EXCEPTION(throwScope, { });
560 }
561 JSValue burstLossRateValue;
562 if (isNullOrUndefined)
563 burstLossRateValue = jsUndefined();
564 else {
565 burstLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossRate"));
566 RETURN_IF_EXCEPTION(throwScope, { });
567 }
568 if (!burstLossRateValue.isUndefined()) {
569 result.burstLossRate = convert<IDLDouble>(lexicalGlobalObject, burstLossRateValue);
570 RETURN_IF_EXCEPTION(throwScope, { });
571 }
572 JSValue burstPacketsDiscardedValue;
573 if (isNullOrUndefined)
574 burstPacketsDiscardedValue = jsUndefined();
575 else {
576 burstPacketsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsDiscarded"));
577 RETURN_IF_EXCEPTION(throwScope, { });
578 }
579 if (!burstPacketsDiscardedValue.isUndefined()) {
580 result.burstPacketsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsDiscardedValue);
581 RETURN_IF_EXCEPTION(throwScope, { });
582 }
583 JSValue burstPacketsLostValue;
584 if (isNullOrUndefined)
585 burstPacketsLostValue = jsUndefined();
586 else {
587 burstPacketsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsLost"));
588 RETURN_IF_EXCEPTION(throwScope, { });
589 }
590 if (!burstPacketsLostValue.isUndefined()) {
591 result.burstPacketsLost = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsLostValue);
592 RETURN_IF_EXCEPTION(throwScope, { });
593 }
594 JSValue framesDroppedValue;
595 if (isNullOrUndefined)
596 framesDroppedValue = jsUndefined();
597 else {
598 framesDroppedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDropped"));
599 RETURN_IF_EXCEPTION(throwScope, { });
600 }
601 if (!framesDroppedValue.isUndefined()) {
602 result.framesDropped = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDroppedValue);
603 RETURN_IF_EXCEPTION(throwScope, { });
604 }
605 JSValue fullFramesLostValue;
606 if (isNullOrUndefined)
607 fullFramesLostValue = jsUndefined();
608 else {
609 fullFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fullFramesLost"));
610 RETURN_IF_EXCEPTION(throwScope, { });
611 }
612 if (!fullFramesLostValue.isUndefined()) {
613 result.fullFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, fullFramesLostValue);
614 RETURN_IF_EXCEPTION(throwScope, { });
615 }
616 JSValue gapDiscardRateValue;
617 if (isNullOrUndefined)
618 gapDiscardRateValue = jsUndefined();
619 else {
620 gapDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapDiscardRate"));
621 RETURN_IF_EXCEPTION(throwScope, { });
622 }
623 if (!gapDiscardRateValue.isUndefined()) {
624 result.gapDiscardRate = convert<IDLDouble>(lexicalGlobalObject, gapDiscardRateValue);
625 RETURN_IF_EXCEPTION(throwScope, { });
626 }
627 JSValue gapLossRateValue;
628 if (isNullOrUndefined)
629 gapLossRateValue = jsUndefined();
630 else {
631 gapLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapLossRate"));
632 RETURN_IF_EXCEPTION(throwScope, { });
633 }
634 if (!gapLossRateValue.isUndefined()) {
635 result.gapLossRate = convert<IDLDouble>(lexicalGlobalObject, gapLossRateValue);
636 RETURN_IF_EXCEPTION(throwScope, { });
637 }
638 JSValue jitterValue;
639 if (isNullOrUndefined)
640 jitterValue = jsUndefined();
641 else {
642 jitterValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitter"));
643 RETURN_IF_EXCEPTION(throwScope, { });
644 }
645 if (!jitterValue.isUndefined()) {
646 result.jitter = convert<IDLDouble>(lexicalGlobalObject, jitterValue);
647 RETURN_IF_EXCEPTION(throwScope, { });
648 }
649 JSValue packetsDiscardedValue;
650 if (isNullOrUndefined)
651 packetsDiscardedValue = jsUndefined();
652 else {
653 packetsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsDiscarded"));
654 RETURN_IF_EXCEPTION(throwScope, { });
655 }
656 if (!packetsDiscardedValue.isUndefined()) {
657 result.packetsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsDiscardedValue);
658 RETURN_IF_EXCEPTION(throwScope, { });
659 }
660 JSValue packetsLostValue;
661 if (isNullOrUndefined)
662 packetsLostValue = jsUndefined();
663 else {
664 packetsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsLost"));
665 RETURN_IF_EXCEPTION(throwScope, { });
666 }
667 if (!packetsLostValue.isUndefined()) {
668 result.packetsLost = convert<IDLLongLong>(lexicalGlobalObject, packetsLostValue);
669 RETURN_IF_EXCEPTION(throwScope, { });
670 }
671 JSValue packetsReceivedValue;
672 if (isNullOrUndefined)
673 packetsReceivedValue = jsUndefined();
674 else {
675 packetsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsReceived"));
676 RETURN_IF_EXCEPTION(throwScope, { });
677 }
678 if (!packetsReceivedValue.isUndefined()) {
679 result.packetsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsReceivedValue);
680 RETURN_IF_EXCEPTION(throwScope, { });
681 }
682 JSValue packetsRepairedValue;
683 if (isNullOrUndefined)
684 packetsRepairedValue = jsUndefined();
685 else {
686 packetsRepairedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsRepaired"));
687 RETURN_IF_EXCEPTION(throwScope, { });
688 }
689 if (!packetsRepairedValue.isUndefined()) {
690 result.packetsRepaired = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsRepairedValue);
691 RETURN_IF_EXCEPTION(throwScope, { });
692 }
693 JSValue partialFramesLostValue;
694 if (isNullOrUndefined)
695 partialFramesLostValue = jsUndefined();
696 else {
697 partialFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialFramesLost"));
698 RETURN_IF_EXCEPTION(throwScope, { });
699 }
700 if (!partialFramesLostValue.isUndefined()) {
701 result.partialFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, partialFramesLostValue);
702 RETURN_IF_EXCEPTION(throwScope, { });
703 }
704 return result;
705}
706
707JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::ReceivedRtpStreamStats& dictionary)
708{
709 auto& vm = JSC::getVM(&lexicalGlobalObject);
710 auto throwScope = DECLARE_THROW_SCOPE(vm);
711
712 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
713
714 if (!IDLDOMString::isNullValue(dictionary.id)) {
715 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
716 RETURN_IF_EXCEPTION(throwScope, { });
717 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
718 }
719 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
720 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
721 RETURN_IF_EXCEPTION(throwScope, { });
722 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
723 }
724 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
725 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
726 RETURN_IF_EXCEPTION(throwScope, { });
727 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
728 }
729 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
730 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
731 RETURN_IF_EXCEPTION(throwScope, { });
732 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
733 }
734 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
735 RETURN_IF_EXCEPTION(throwScope, { });
736 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
737 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
738 RETURN_IF_EXCEPTION(throwScope, { });
739 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
740 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
741 RETURN_IF_EXCEPTION(throwScope, { });
742 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
743 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
744 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
745 RETURN_IF_EXCEPTION(throwScope, { });
746 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
747 }
748 if (!IDLUnsignedLong::isNullValue(dictionary.burstDiscardCount)) {
749 auto burstDiscardCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstDiscardCount));
750 RETURN_IF_EXCEPTION(throwScope, { });
751 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardCount"), burstDiscardCountValue);
752 }
753 if (!IDLDouble::isNullValue(dictionary.burstDiscardRate)) {
754 auto burstDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstDiscardRate));
755 RETURN_IF_EXCEPTION(throwScope, { });
756 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardRate"), burstDiscardRateValue);
757 }
758 if (!IDLUnsignedLong::isNullValue(dictionary.burstLossCount)) {
759 auto burstLossCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstLossCount));
760 RETURN_IF_EXCEPTION(throwScope, { });
761 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossCount"), burstLossCountValue);
762 }
763 if (!IDLDouble::isNullValue(dictionary.burstLossRate)) {
764 auto burstLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstLossRate));
765 RETURN_IF_EXCEPTION(throwScope, { });
766 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossRate"), burstLossRateValue);
767 }
768 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsDiscarded)) {
769 auto burstPacketsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsDiscarded));
770 RETURN_IF_EXCEPTION(throwScope, { });
771 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsDiscarded"), burstPacketsDiscardedValue);
772 }
773 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsLost)) {
774 auto burstPacketsLostValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsLost));
775 RETURN_IF_EXCEPTION(throwScope, { });
776 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsLost"), burstPacketsLostValue);
777 }
778 if (!IDLUnsignedLong::isNullValue(dictionary.framesDropped)) {
779 auto framesDroppedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDropped));
780 RETURN_IF_EXCEPTION(throwScope, { });
781 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDropped"), framesDroppedValue);
782 }
783 if (!IDLUnsignedLong::isNullValue(dictionary.fullFramesLost)) {
784 auto fullFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.fullFramesLost));
785 RETURN_IF_EXCEPTION(throwScope, { });
786 result->putDirect(vm, JSC::Identifier::fromString(vm, "fullFramesLost"), fullFramesLostValue);
787 }
788 if (!IDLDouble::isNullValue(dictionary.gapDiscardRate)) {
789 auto gapDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapDiscardRate));
790 RETURN_IF_EXCEPTION(throwScope, { });
791 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapDiscardRate"), gapDiscardRateValue);
792 }
793 if (!IDLDouble::isNullValue(dictionary.gapLossRate)) {
794 auto gapLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapLossRate));
795 RETURN_IF_EXCEPTION(throwScope, { });
796 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapLossRate"), gapLossRateValue);
797 }
798 if (!IDLDouble::isNullValue(dictionary.jitter)) {
799 auto jitterValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.jitter));
800 RETURN_IF_EXCEPTION(throwScope, { });
801 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitter"), jitterValue);
802 }
803 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsDiscarded)) {
804 auto packetsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsDiscarded));
805 RETURN_IF_EXCEPTION(throwScope, { });
806 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsDiscarded"), packetsDiscardedValue);
807 }
808 if (!IDLLongLong::isNullValue(dictionary.packetsLost)) {
809 auto packetsLostValue = toJS<IDLLongLong>(lexicalGlobalObject, throwScope, IDLLongLong::extractValueFromNullable(dictionary.packetsLost));
810 RETURN_IF_EXCEPTION(throwScope, { });
811 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsLost"), packetsLostValue);
812 }
813 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsReceived)) {
814 auto packetsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsReceived));
815 RETURN_IF_EXCEPTION(throwScope, { });
816 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsReceived"), packetsReceivedValue);
817 }
818 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsRepaired)) {
819 auto packetsRepairedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsRepaired));
820 RETURN_IF_EXCEPTION(throwScope, { });
821 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsRepaired"), packetsRepairedValue);
822 }
823 if (!IDLUnsignedLong::isNullValue(dictionary.partialFramesLost)) {
824 auto partialFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.partialFramesLost));
825 RETURN_IF_EXCEPTION(throwScope, { });
826 result->putDirect(vm, JSC::Identifier::fromString(vm, "partialFramesLost"), partialFramesLostValue);
827 }
828 return result;
829}
830
831template<> RTCStatsReport::InboundRtpStreamStats convertDictionary<RTCStatsReport::InboundRtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
832{
833 VM& vm = JSC::getVM(&lexicalGlobalObject);
834 auto throwScope = DECLARE_THROW_SCOPE(vm);
835 bool isNullOrUndefined = value.isUndefinedOrNull();
836 auto* object = isNullOrUndefined ? nullptr : value.getObject();
837 if (UNLIKELY(!isNullOrUndefined && !object)) {
838 throwTypeError(&lexicalGlobalObject, throwScope);
839 return { };
840 }
841 RTCStatsReport::InboundRtpStreamStats result;
842 JSValue idValue;
843 if (isNullOrUndefined)
844 idValue = jsUndefined();
845 else {
846 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
847 RETURN_IF_EXCEPTION(throwScope, { });
848 }
849 if (!idValue.isUndefined()) {
850 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
851 RETURN_IF_EXCEPTION(throwScope, { });
852 }
853 JSValue timestampValue;
854 if (isNullOrUndefined)
855 timestampValue = jsUndefined();
856 else {
857 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
858 RETURN_IF_EXCEPTION(throwScope, { });
859 }
860 if (!timestampValue.isUndefined()) {
861 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
862 RETURN_IF_EXCEPTION(throwScope, { });
863 }
864 JSValue typeValue;
865 if (isNullOrUndefined)
866 typeValue = jsUndefined();
867 else {
868 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
869 RETURN_IF_EXCEPTION(throwScope, { });
870 }
871 if (!typeValue.isUndefined()) {
872 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
873 RETURN_IF_EXCEPTION(throwScope, { });
874 }
875 JSValue codecIdValue;
876 if (isNullOrUndefined)
877 codecIdValue = jsUndefined();
878 else {
879 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
880 RETURN_IF_EXCEPTION(throwScope, { });
881 }
882 if (!codecIdValue.isUndefined()) {
883 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
884 RETURN_IF_EXCEPTION(throwScope, { });
885 }
886 JSValue kindValue;
887 if (isNullOrUndefined)
888 kindValue = jsUndefined();
889 else {
890 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
891 RETURN_IF_EXCEPTION(throwScope, { });
892 }
893 if (!kindValue.isUndefined()) {
894 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
895 RETURN_IF_EXCEPTION(throwScope, { });
896 } else {
897 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCInboundRtpStreamStats", "DOMString");
898 return { };
899 }
900 JSValue mediaTypeValue;
901 if (isNullOrUndefined)
902 mediaTypeValue = jsUndefined();
903 else {
904 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
905 RETURN_IF_EXCEPTION(throwScope, { });
906 }
907 if (!mediaTypeValue.isUndefined()) {
908 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
909 RETURN_IF_EXCEPTION(throwScope, { });
910 } else {
911 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCInboundRtpStreamStats", "DOMString");
912 return { };
913 }
914 JSValue ssrcValue;
915 if (isNullOrUndefined)
916 ssrcValue = jsUndefined();
917 else {
918 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
919 RETURN_IF_EXCEPTION(throwScope, { });
920 }
921 if (!ssrcValue.isUndefined()) {
922 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
923 RETURN_IF_EXCEPTION(throwScope, { });
924 } else {
925 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCInboundRtpStreamStats", "unsigned long");
926 return { };
927 }
928 JSValue transportIdValue;
929 if (isNullOrUndefined)
930 transportIdValue = jsUndefined();
931 else {
932 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
933 RETURN_IF_EXCEPTION(throwScope, { });
934 }
935 if (!transportIdValue.isUndefined()) {
936 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
937 RETURN_IF_EXCEPTION(throwScope, { });
938 }
939 JSValue burstDiscardCountValue;
940 if (isNullOrUndefined)
941 burstDiscardCountValue = jsUndefined();
942 else {
943 burstDiscardCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardCount"));
944 RETURN_IF_EXCEPTION(throwScope, { });
945 }
946 if (!burstDiscardCountValue.isUndefined()) {
947 result.burstDiscardCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstDiscardCountValue);
948 RETURN_IF_EXCEPTION(throwScope, { });
949 }
950 JSValue burstDiscardRateValue;
951 if (isNullOrUndefined)
952 burstDiscardRateValue = jsUndefined();
953 else {
954 burstDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardRate"));
955 RETURN_IF_EXCEPTION(throwScope, { });
956 }
957 if (!burstDiscardRateValue.isUndefined()) {
958 result.burstDiscardRate = convert<IDLDouble>(lexicalGlobalObject, burstDiscardRateValue);
959 RETURN_IF_EXCEPTION(throwScope, { });
960 }
961 JSValue burstLossCountValue;
962 if (isNullOrUndefined)
963 burstLossCountValue = jsUndefined();
964 else {
965 burstLossCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossCount"));
966 RETURN_IF_EXCEPTION(throwScope, { });
967 }
968 if (!burstLossCountValue.isUndefined()) {
969 result.burstLossCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstLossCountValue);
970 RETURN_IF_EXCEPTION(throwScope, { });
971 }
972 JSValue burstLossRateValue;
973 if (isNullOrUndefined)
974 burstLossRateValue = jsUndefined();
975 else {
976 burstLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossRate"));
977 RETURN_IF_EXCEPTION(throwScope, { });
978 }
979 if (!burstLossRateValue.isUndefined()) {
980 result.burstLossRate = convert<IDLDouble>(lexicalGlobalObject, burstLossRateValue);
981 RETURN_IF_EXCEPTION(throwScope, { });
982 }
983 JSValue burstPacketsDiscardedValue;
984 if (isNullOrUndefined)
985 burstPacketsDiscardedValue = jsUndefined();
986 else {
987 burstPacketsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsDiscarded"));
988 RETURN_IF_EXCEPTION(throwScope, { });
989 }
990 if (!burstPacketsDiscardedValue.isUndefined()) {
991 result.burstPacketsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsDiscardedValue);
992 RETURN_IF_EXCEPTION(throwScope, { });
993 }
994 JSValue burstPacketsLostValue;
995 if (isNullOrUndefined)
996 burstPacketsLostValue = jsUndefined();
997 else {
998 burstPacketsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsLost"));
999 RETURN_IF_EXCEPTION(throwScope, { });
1000 }
1001 if (!burstPacketsLostValue.isUndefined()) {
1002 result.burstPacketsLost = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsLostValue);
1003 RETURN_IF_EXCEPTION(throwScope, { });
1004 }
1005 JSValue framesDroppedValue;
1006 if (isNullOrUndefined)
1007 framesDroppedValue = jsUndefined();
1008 else {
1009 framesDroppedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDropped"));
1010 RETURN_IF_EXCEPTION(throwScope, { });
1011 }
1012 if (!framesDroppedValue.isUndefined()) {
1013 result.framesDropped = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDroppedValue);
1014 RETURN_IF_EXCEPTION(throwScope, { });
1015 }
1016 JSValue fullFramesLostValue;
1017 if (isNullOrUndefined)
1018 fullFramesLostValue = jsUndefined();
1019 else {
1020 fullFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fullFramesLost"));
1021 RETURN_IF_EXCEPTION(throwScope, { });
1022 }
1023 if (!fullFramesLostValue.isUndefined()) {
1024 result.fullFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, fullFramesLostValue);
1025 RETURN_IF_EXCEPTION(throwScope, { });
1026 }
1027 JSValue gapDiscardRateValue;
1028 if (isNullOrUndefined)
1029 gapDiscardRateValue = jsUndefined();
1030 else {
1031 gapDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapDiscardRate"));
1032 RETURN_IF_EXCEPTION(throwScope, { });
1033 }
1034 if (!gapDiscardRateValue.isUndefined()) {
1035 result.gapDiscardRate = convert<IDLDouble>(lexicalGlobalObject, gapDiscardRateValue);
1036 RETURN_IF_EXCEPTION(throwScope, { });
1037 }
1038 JSValue gapLossRateValue;
1039 if (isNullOrUndefined)
1040 gapLossRateValue = jsUndefined();
1041 else {
1042 gapLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapLossRate"));
1043 RETURN_IF_EXCEPTION(throwScope, { });
1044 }
1045 if (!gapLossRateValue.isUndefined()) {
1046 result.gapLossRate = convert<IDLDouble>(lexicalGlobalObject, gapLossRateValue);
1047 RETURN_IF_EXCEPTION(throwScope, { });
1048 }
1049 JSValue jitterValue;
1050 if (isNullOrUndefined)
1051 jitterValue = jsUndefined();
1052 else {
1053 jitterValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitter"));
1054 RETURN_IF_EXCEPTION(throwScope, { });
1055 }
1056 if (!jitterValue.isUndefined()) {
1057 result.jitter = convert<IDLDouble>(lexicalGlobalObject, jitterValue);
1058 RETURN_IF_EXCEPTION(throwScope, { });
1059 }
1060 JSValue packetsDiscardedValue;
1061 if (isNullOrUndefined)
1062 packetsDiscardedValue = jsUndefined();
1063 else {
1064 packetsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsDiscarded"));
1065 RETURN_IF_EXCEPTION(throwScope, { });
1066 }
1067 if (!packetsDiscardedValue.isUndefined()) {
1068 result.packetsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsDiscardedValue);
1069 RETURN_IF_EXCEPTION(throwScope, { });
1070 }
1071 JSValue packetsLostValue;
1072 if (isNullOrUndefined)
1073 packetsLostValue = jsUndefined();
1074 else {
1075 packetsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsLost"));
1076 RETURN_IF_EXCEPTION(throwScope, { });
1077 }
1078 if (!packetsLostValue.isUndefined()) {
1079 result.packetsLost = convert<IDLLongLong>(lexicalGlobalObject, packetsLostValue);
1080 RETURN_IF_EXCEPTION(throwScope, { });
1081 }
1082 JSValue packetsReceivedValue;
1083 if (isNullOrUndefined)
1084 packetsReceivedValue = jsUndefined();
1085 else {
1086 packetsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsReceived"));
1087 RETURN_IF_EXCEPTION(throwScope, { });
1088 }
1089 if (!packetsReceivedValue.isUndefined()) {
1090 result.packetsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsReceivedValue);
1091 RETURN_IF_EXCEPTION(throwScope, { });
1092 }
1093 JSValue packetsRepairedValue;
1094 if (isNullOrUndefined)
1095 packetsRepairedValue = jsUndefined();
1096 else {
1097 packetsRepairedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsRepaired"));
1098 RETURN_IF_EXCEPTION(throwScope, { });
1099 }
1100 if (!packetsRepairedValue.isUndefined()) {
1101 result.packetsRepaired = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsRepairedValue);
1102 RETURN_IF_EXCEPTION(throwScope, { });
1103 }
1104 JSValue partialFramesLostValue;
1105 if (isNullOrUndefined)
1106 partialFramesLostValue = jsUndefined();
1107 else {
1108 partialFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialFramesLost"));
1109 RETURN_IF_EXCEPTION(throwScope, { });
1110 }
1111 if (!partialFramesLostValue.isUndefined()) {
1112 result.partialFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, partialFramesLostValue);
1113 RETURN_IF_EXCEPTION(throwScope, { });
1114 }
1115 JSValue audioLevelValue;
1116 if (isNullOrUndefined)
1117 audioLevelValue = jsUndefined();
1118 else {
1119 audioLevelValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "audioLevel"));
1120 RETURN_IF_EXCEPTION(throwScope, { });
1121 }
1122 if (!audioLevelValue.isUndefined()) {
1123 result.audioLevel = convert<IDLDouble>(lexicalGlobalObject, audioLevelValue);
1124 RETURN_IF_EXCEPTION(throwScope, { });
1125 }
1126 JSValue averageRtcpIntervalValue;
1127 if (isNullOrUndefined)
1128 averageRtcpIntervalValue = jsUndefined();
1129 else {
1130 averageRtcpIntervalValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "averageRtcpInterval"));
1131 RETURN_IF_EXCEPTION(throwScope, { });
1132 }
1133 if (!averageRtcpIntervalValue.isUndefined()) {
1134 result.averageRtcpInterval = convert<IDLDouble>(lexicalGlobalObject, averageRtcpIntervalValue);
1135 RETURN_IF_EXCEPTION(throwScope, { });
1136 }
1137 JSValue bytesReceivedValue;
1138 if (isNullOrUndefined)
1139 bytesReceivedValue = jsUndefined();
1140 else {
1141 bytesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesReceived"));
1142 RETURN_IF_EXCEPTION(throwScope, { });
1143 }
1144 if (!bytesReceivedValue.isUndefined()) {
1145 result.bytesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesReceivedValue);
1146 RETURN_IF_EXCEPTION(throwScope, { });
1147 }
1148 JSValue concealedSamplesValue;
1149 if (isNullOrUndefined)
1150 concealedSamplesValue = jsUndefined();
1151 else {
1152 concealedSamplesValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "concealedSamples"));
1153 RETURN_IF_EXCEPTION(throwScope, { });
1154 }
1155 if (!concealedSamplesValue.isUndefined()) {
1156 result.concealedSamples = convert<IDLUnsignedLongLong>(lexicalGlobalObject, concealedSamplesValue);
1157 RETURN_IF_EXCEPTION(throwScope, { });
1158 }
1159 JSValue concealmentEventsValue;
1160 if (isNullOrUndefined)
1161 concealmentEventsValue = jsUndefined();
1162 else {
1163 concealmentEventsValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "concealmentEvents"));
1164 RETURN_IF_EXCEPTION(throwScope, { });
1165 }
1166 if (!concealmentEventsValue.isUndefined()) {
1167 result.concealmentEvents = convert<IDLUnsignedLongLong>(lexicalGlobalObject, concealmentEventsValue);
1168 RETURN_IF_EXCEPTION(throwScope, { });
1169 }
1170 JSValue estimatedPlayoutTimestampValue;
1171 if (isNullOrUndefined)
1172 estimatedPlayoutTimestampValue = jsUndefined();
1173 else {
1174 estimatedPlayoutTimestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "estimatedPlayoutTimestamp"));
1175 RETURN_IF_EXCEPTION(throwScope, { });
1176 }
1177 if (!estimatedPlayoutTimestampValue.isUndefined()) {
1178 result.estimatedPlayoutTimestamp = convert<IDLDouble>(lexicalGlobalObject, estimatedPlayoutTimestampValue);
1179 RETURN_IF_EXCEPTION(throwScope, { });
1180 }
1181 JSValue fecPacketsDiscardedValue;
1182 if (isNullOrUndefined)
1183 fecPacketsDiscardedValue = jsUndefined();
1184 else {
1185 fecPacketsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fecPacketsDiscarded"));
1186 RETURN_IF_EXCEPTION(throwScope, { });
1187 }
1188 if (!fecPacketsDiscardedValue.isUndefined()) {
1189 result.fecPacketsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, fecPacketsDiscardedValue);
1190 RETURN_IF_EXCEPTION(throwScope, { });
1191 }
1192 JSValue fecPacketsReceivedValue;
1193 if (isNullOrUndefined)
1194 fecPacketsReceivedValue = jsUndefined();
1195 else {
1196 fecPacketsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fecPacketsReceived"));
1197 RETURN_IF_EXCEPTION(throwScope, { });
1198 }
1199 if (!fecPacketsReceivedValue.isUndefined()) {
1200 result.fecPacketsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, fecPacketsReceivedValue);
1201 RETURN_IF_EXCEPTION(throwScope, { });
1202 }
1203 JSValue firCountValue;
1204 if (isNullOrUndefined)
1205 firCountValue = jsUndefined();
1206 else {
1207 firCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "firCount"));
1208 RETURN_IF_EXCEPTION(throwScope, { });
1209 }
1210 if (!firCountValue.isUndefined()) {
1211 result.firCount = convert<IDLUnsignedLong>(lexicalGlobalObject, firCountValue);
1212 RETURN_IF_EXCEPTION(throwScope, { });
1213 }
1214 JSValue frameBitDepthValue;
1215 if (isNullOrUndefined)
1216 frameBitDepthValue = jsUndefined();
1217 else {
1218 frameBitDepthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameBitDepth"));
1219 RETURN_IF_EXCEPTION(throwScope, { });
1220 }
1221 if (!frameBitDepthValue.isUndefined()) {
1222 result.frameBitDepth = convert<IDLUnsignedLong>(lexicalGlobalObject, frameBitDepthValue);
1223 RETURN_IF_EXCEPTION(throwScope, { });
1224 }
1225 JSValue frameHeightValue;
1226 if (isNullOrUndefined)
1227 frameHeightValue = jsUndefined();
1228 else {
1229 frameHeightValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameHeight"));
1230 RETURN_IF_EXCEPTION(throwScope, { });
1231 }
1232 if (!frameHeightValue.isUndefined()) {
1233 result.frameHeight = convert<IDLUnsignedLong>(lexicalGlobalObject, frameHeightValue);
1234 RETURN_IF_EXCEPTION(throwScope, { });
1235 }
1236 JSValue frameWidthValue;
1237 if (isNullOrUndefined)
1238 frameWidthValue = jsUndefined();
1239 else {
1240 frameWidthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameWidth"));
1241 RETURN_IF_EXCEPTION(throwScope, { });
1242 }
1243 if (!frameWidthValue.isUndefined()) {
1244 result.frameWidth = convert<IDLUnsignedLong>(lexicalGlobalObject, frameWidthValue);
1245 RETURN_IF_EXCEPTION(throwScope, { });
1246 }
1247 JSValue framesDecodedValue;
1248 if (isNullOrUndefined)
1249 framesDecodedValue = jsUndefined();
1250 else {
1251 framesDecodedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDecoded"));
1252 RETURN_IF_EXCEPTION(throwScope, { });
1253 }
1254 if (!framesDecodedValue.isUndefined()) {
1255 result.framesDecoded = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDecodedValue);
1256 RETURN_IF_EXCEPTION(throwScope, { });
1257 }
1258 JSValue framesPerSecondValue;
1259 if (isNullOrUndefined)
1260 framesPerSecondValue = jsUndefined();
1261 else {
1262 framesPerSecondValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesPerSecond"));
1263 RETURN_IF_EXCEPTION(throwScope, { });
1264 }
1265 if (!framesPerSecondValue.isUndefined()) {
1266 result.framesPerSecond = convert<IDLDouble>(lexicalGlobalObject, framesPerSecondValue);
1267 RETURN_IF_EXCEPTION(throwScope, { });
1268 }
1269 JSValue framesReceivedValue;
1270 if (isNullOrUndefined)
1271 framesReceivedValue = jsUndefined();
1272 else {
1273 framesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesReceived"));
1274 RETURN_IF_EXCEPTION(throwScope, { });
1275 }
1276 if (!framesReceivedValue.isUndefined()) {
1277 result.framesReceived = convert<IDLUnsignedLong>(lexicalGlobalObject, framesReceivedValue);
1278 RETURN_IF_EXCEPTION(throwScope, { });
1279 }
1280 JSValue headerBytesReceivedValue;
1281 if (isNullOrUndefined)
1282 headerBytesReceivedValue = jsUndefined();
1283 else {
1284 headerBytesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "headerBytesReceived"));
1285 RETURN_IF_EXCEPTION(throwScope, { });
1286 }
1287 if (!headerBytesReceivedValue.isUndefined()) {
1288 result.headerBytesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, headerBytesReceivedValue);
1289 RETURN_IF_EXCEPTION(throwScope, { });
1290 }
1291 JSValue insertedSamplesForDecelerationValue;
1292 if (isNullOrUndefined)
1293 insertedSamplesForDecelerationValue = jsUndefined();
1294 else {
1295 insertedSamplesForDecelerationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "insertedSamplesForDeceleration"));
1296 RETURN_IF_EXCEPTION(throwScope, { });
1297 }
1298 if (!insertedSamplesForDecelerationValue.isUndefined()) {
1299 result.insertedSamplesForDeceleration = convert<IDLUnsignedLongLong>(lexicalGlobalObject, insertedSamplesForDecelerationValue);
1300 RETURN_IF_EXCEPTION(throwScope, { });
1301 }
1302 JSValue jitterBufferDelayValue;
1303 if (isNullOrUndefined)
1304 jitterBufferDelayValue = jsUndefined();
1305 else {
1306 jitterBufferDelayValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitterBufferDelay"));
1307 RETURN_IF_EXCEPTION(throwScope, { });
1308 }
1309 if (!jitterBufferDelayValue.isUndefined()) {
1310 result.jitterBufferDelay = convert<IDLDouble>(lexicalGlobalObject, jitterBufferDelayValue);
1311 RETURN_IF_EXCEPTION(throwScope, { });
1312 }
1313 JSValue jitterBufferEmittedCountValue;
1314 if (isNullOrUndefined)
1315 jitterBufferEmittedCountValue = jsUndefined();
1316 else {
1317 jitterBufferEmittedCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitterBufferEmittedCount"));
1318 RETURN_IF_EXCEPTION(throwScope, { });
1319 }
1320 if (!jitterBufferEmittedCountValue.isUndefined()) {
1321 result.jitterBufferEmittedCount = convert<IDLUnsignedLongLong>(lexicalGlobalObject, jitterBufferEmittedCountValue);
1322 RETURN_IF_EXCEPTION(throwScope, { });
1323 }
1324 JSValue keyFramesDecodedValue;
1325 if (isNullOrUndefined)
1326 keyFramesDecodedValue = jsUndefined();
1327 else {
1328 keyFramesDecodedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "keyFramesDecoded"));
1329 RETURN_IF_EXCEPTION(throwScope, { });
1330 }
1331 if (!keyFramesDecodedValue.isUndefined()) {
1332 result.keyFramesDecoded = convert<IDLUnsignedLong>(lexicalGlobalObject, keyFramesDecodedValue);
1333 RETURN_IF_EXCEPTION(throwScope, { });
1334 }
1335 JSValue lastPacketReceivedTimestampValue;
1336 if (isNullOrUndefined)
1337 lastPacketReceivedTimestampValue = jsUndefined();
1338 else {
1339 lastPacketReceivedTimestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "lastPacketReceivedTimestamp"));
1340 RETURN_IF_EXCEPTION(throwScope, { });
1341 }
1342 if (!lastPacketReceivedTimestampValue.isUndefined()) {
1343 result.lastPacketReceivedTimestamp = convert<IDLDouble>(lexicalGlobalObject, lastPacketReceivedTimestampValue);
1344 RETURN_IF_EXCEPTION(throwScope, { });
1345 }
1346 JSValue nackCountValue;
1347 if (isNullOrUndefined)
1348 nackCountValue = jsUndefined();
1349 else {
1350 nackCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "nackCount"));
1351 RETURN_IF_EXCEPTION(throwScope, { });
1352 }
1353 if (!nackCountValue.isUndefined()) {
1354 result.nackCount = convert<IDLUnsignedLong>(lexicalGlobalObject, nackCountValue);
1355 RETURN_IF_EXCEPTION(throwScope, { });
1356 }
1357 JSValue packetsDuplicatedValue;
1358 if (isNullOrUndefined)
1359 packetsDuplicatedValue = jsUndefined();
1360 else {
1361 packetsDuplicatedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsDuplicated"));
1362 RETURN_IF_EXCEPTION(throwScope, { });
1363 }
1364 if (!packetsDuplicatedValue.isUndefined()) {
1365 result.packetsDuplicated = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsDuplicatedValue);
1366 RETURN_IF_EXCEPTION(throwScope, { });
1367 }
1368 JSValue packetsFailedDecryptionValue;
1369 if (isNullOrUndefined)
1370 packetsFailedDecryptionValue = jsUndefined();
1371 else {
1372 packetsFailedDecryptionValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsFailedDecryption"));
1373 RETURN_IF_EXCEPTION(throwScope, { });
1374 }
1375 if (!packetsFailedDecryptionValue.isUndefined()) {
1376 result.packetsFailedDecryption = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsFailedDecryptionValue);
1377 RETURN_IF_EXCEPTION(throwScope, { });
1378 }
1379 JSValue pliCountValue;
1380 if (isNullOrUndefined)
1381 pliCountValue = jsUndefined();
1382 else {
1383 pliCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "pliCount"));
1384 RETURN_IF_EXCEPTION(throwScope, { });
1385 }
1386 if (!pliCountValue.isUndefined()) {
1387 result.pliCount = convert<IDLUnsignedLong>(lexicalGlobalObject, pliCountValue);
1388 RETURN_IF_EXCEPTION(throwScope, { });
1389 }
1390 JSValue qpSumValue;
1391 if (isNullOrUndefined)
1392 qpSumValue = jsUndefined();
1393 else {
1394 qpSumValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "qpSum"));
1395 RETURN_IF_EXCEPTION(throwScope, { });
1396 }
1397 if (!qpSumValue.isUndefined()) {
1398 result.qpSum = convert<IDLUnsignedLongLong>(lexicalGlobalObject, qpSumValue);
1399 RETURN_IF_EXCEPTION(throwScope, { });
1400 }
1401 JSValue remoteIdValue;
1402 if (isNullOrUndefined)
1403 remoteIdValue = jsUndefined();
1404 else {
1405 remoteIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "remoteId"));
1406 RETURN_IF_EXCEPTION(throwScope, { });
1407 }
1408 if (!remoteIdValue.isUndefined()) {
1409 result.remoteId = convert<IDLDOMString>(lexicalGlobalObject, remoteIdValue);
1410 RETURN_IF_EXCEPTION(throwScope, { });
1411 }
1412 JSValue removedSamplesForAccelerationValue;
1413 if (isNullOrUndefined)
1414 removedSamplesForAccelerationValue = jsUndefined();
1415 else {
1416 removedSamplesForAccelerationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "removedSamplesForAcceleration"));
1417 RETURN_IF_EXCEPTION(throwScope, { });
1418 }
1419 if (!removedSamplesForAccelerationValue.isUndefined()) {
1420 result.removedSamplesForAcceleration = convert<IDLUnsignedLongLong>(lexicalGlobalObject, removedSamplesForAccelerationValue);
1421 RETURN_IF_EXCEPTION(throwScope, { });
1422 }
1423 JSValue samplesDecodedWithCeltValue;
1424 if (isNullOrUndefined)
1425 samplesDecodedWithCeltValue = jsUndefined();
1426 else {
1427 samplesDecodedWithCeltValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "samplesDecodedWithCelt"));
1428 RETURN_IF_EXCEPTION(throwScope, { });
1429 }
1430 if (!samplesDecodedWithCeltValue.isUndefined()) {
1431 result.samplesDecodedWithCelt = convert<IDLUnsignedLongLong>(lexicalGlobalObject, samplesDecodedWithCeltValue);
1432 RETURN_IF_EXCEPTION(throwScope, { });
1433 }
1434 JSValue samplesDecodedWithSilkValue;
1435 if (isNullOrUndefined)
1436 samplesDecodedWithSilkValue = jsUndefined();
1437 else {
1438 samplesDecodedWithSilkValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "samplesDecodedWithSilk"));
1439 RETURN_IF_EXCEPTION(throwScope, { });
1440 }
1441 if (!samplesDecodedWithSilkValue.isUndefined()) {
1442 result.samplesDecodedWithSilk = convert<IDLUnsignedLongLong>(lexicalGlobalObject, samplesDecodedWithSilkValue);
1443 RETURN_IF_EXCEPTION(throwScope, { });
1444 }
1445 JSValue silentConcealedSamplesValue;
1446 if (isNullOrUndefined)
1447 silentConcealedSamplesValue = jsUndefined();
1448 else {
1449 silentConcealedSamplesValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "silentConcealedSamples"));
1450 RETURN_IF_EXCEPTION(throwScope, { });
1451 }
1452 if (!silentConcealedSamplesValue.isUndefined()) {
1453 result.silentConcealedSamples = convert<IDLUnsignedLongLong>(lexicalGlobalObject, silentConcealedSamplesValue);
1454 RETURN_IF_EXCEPTION(throwScope, { });
1455 }
1456 JSValue sliCountValue;
1457 if (isNullOrUndefined)
1458 sliCountValue = jsUndefined();
1459 else {
1460 sliCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "sliCount"));
1461 RETURN_IF_EXCEPTION(throwScope, { });
1462 }
1463 if (!sliCountValue.isUndefined()) {
1464 result.sliCount = convert<IDLUnsignedLong>(lexicalGlobalObject, sliCountValue);
1465 RETURN_IF_EXCEPTION(throwScope, { });
1466 }
1467 JSValue totalAudioEnergyValue;
1468 if (isNullOrUndefined)
1469 totalAudioEnergyValue = jsUndefined();
1470 else {
1471 totalAudioEnergyValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalAudioEnergy"));
1472 RETURN_IF_EXCEPTION(throwScope, { });
1473 }
1474 if (!totalAudioEnergyValue.isUndefined()) {
1475 result.totalAudioEnergy = convert<IDLDouble>(lexicalGlobalObject, totalAudioEnergyValue);
1476 RETURN_IF_EXCEPTION(throwScope, { });
1477 }
1478 JSValue totalDecodeTimeValue;
1479 if (isNullOrUndefined)
1480 totalDecodeTimeValue = jsUndefined();
1481 else {
1482 totalDecodeTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalDecodeTime"));
1483 RETURN_IF_EXCEPTION(throwScope, { });
1484 }
1485 if (!totalDecodeTimeValue.isUndefined()) {
1486 result.totalDecodeTime = convert<IDLDouble>(lexicalGlobalObject, totalDecodeTimeValue);
1487 RETURN_IF_EXCEPTION(throwScope, { });
1488 }
1489 JSValue totalInterFrameDelayValue;
1490 if (isNullOrUndefined)
1491 totalInterFrameDelayValue = jsUndefined();
1492 else {
1493 totalInterFrameDelayValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalInterFrameDelay"));
1494 RETURN_IF_EXCEPTION(throwScope, { });
1495 }
1496 if (!totalInterFrameDelayValue.isUndefined()) {
1497 result.totalInterFrameDelay = convert<IDLDouble>(lexicalGlobalObject, totalInterFrameDelayValue);
1498 RETURN_IF_EXCEPTION(throwScope, { });
1499 }
1500 JSValue totalSamplesDurationValue;
1501 if (isNullOrUndefined)
1502 totalSamplesDurationValue = jsUndefined();
1503 else {
1504 totalSamplesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalSamplesDuration"));
1505 RETURN_IF_EXCEPTION(throwScope, { });
1506 }
1507 if (!totalSamplesDurationValue.isUndefined()) {
1508 result.totalSamplesDuration = convert<IDLDouble>(lexicalGlobalObject, totalSamplesDurationValue);
1509 RETURN_IF_EXCEPTION(throwScope, { });
1510 }
1511 JSValue totalSamplesReceivedValue;
1512 if (isNullOrUndefined)
1513 totalSamplesReceivedValue = jsUndefined();
1514 else {
1515 totalSamplesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalSamplesReceived"));
1516 RETURN_IF_EXCEPTION(throwScope, { });
1517 }
1518 if (!totalSamplesReceivedValue.isUndefined()) {
1519 result.totalSamplesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, totalSamplesReceivedValue);
1520 RETURN_IF_EXCEPTION(throwScope, { });
1521 }
1522 JSValue totalSquaredInterFrameDelayValue;
1523 if (isNullOrUndefined)
1524 totalSquaredInterFrameDelayValue = jsUndefined();
1525 else {
1526 totalSquaredInterFrameDelayValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalSquaredInterFrameDelay"));
1527 RETURN_IF_EXCEPTION(throwScope, { });
1528 }
1529 if (!totalSquaredInterFrameDelayValue.isUndefined()) {
1530 result.totalSquaredInterFrameDelay = convert<IDLDouble>(lexicalGlobalObject, totalSquaredInterFrameDelayValue);
1531 RETURN_IF_EXCEPTION(throwScope, { });
1532 }
1533 JSValue trackIdValue;
1534 if (isNullOrUndefined)
1535 trackIdValue = jsUndefined();
1536 else {
1537 trackIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackId"));
1538 RETURN_IF_EXCEPTION(throwScope, { });
1539 }
1540 if (!trackIdValue.isUndefined()) {
1541 result.trackId = convert<IDLDOMString>(lexicalGlobalObject, trackIdValue);
1542 RETURN_IF_EXCEPTION(throwScope, { });
1543 }
1544 JSValue voiceActivityFlagValue;
1545 if (isNullOrUndefined)
1546 voiceActivityFlagValue = jsUndefined();
1547 else {
1548 voiceActivityFlagValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "voiceActivityFlag"));
1549 RETURN_IF_EXCEPTION(throwScope, { });
1550 }
1551 if (!voiceActivityFlagValue.isUndefined()) {
1552 result.voiceActivityFlag = convert<IDLBoolean>(lexicalGlobalObject, voiceActivityFlagValue);
1553 RETURN_IF_EXCEPTION(throwScope, { });
1554 }
1555 return result;
1556}
1557
1558JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::InboundRtpStreamStats& dictionary)
1559{
1560 auto& vm = JSC::getVM(&lexicalGlobalObject);
1561 auto throwScope = DECLARE_THROW_SCOPE(vm);
1562
1563 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
1564
1565 if (!IDLDOMString::isNullValue(dictionary.id)) {
1566 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
1567 RETURN_IF_EXCEPTION(throwScope, { });
1568 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
1569 }
1570 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
1571 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
1572 RETURN_IF_EXCEPTION(throwScope, { });
1573 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
1574 }
1575 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
1576 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
1577 RETURN_IF_EXCEPTION(throwScope, { });
1578 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
1579 }
1580 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
1581 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
1582 RETURN_IF_EXCEPTION(throwScope, { });
1583 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
1584 }
1585 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
1586 RETURN_IF_EXCEPTION(throwScope, { });
1587 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
1588 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
1589 RETURN_IF_EXCEPTION(throwScope, { });
1590 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
1591 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
1592 RETURN_IF_EXCEPTION(throwScope, { });
1593 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
1594 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
1595 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
1596 RETURN_IF_EXCEPTION(throwScope, { });
1597 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
1598 }
1599 if (!IDLUnsignedLong::isNullValue(dictionary.burstDiscardCount)) {
1600 auto burstDiscardCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstDiscardCount));
1601 RETURN_IF_EXCEPTION(throwScope, { });
1602 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardCount"), burstDiscardCountValue);
1603 }
1604 if (!IDLDouble::isNullValue(dictionary.burstDiscardRate)) {
1605 auto burstDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstDiscardRate));
1606 RETURN_IF_EXCEPTION(throwScope, { });
1607 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardRate"), burstDiscardRateValue);
1608 }
1609 if (!IDLUnsignedLong::isNullValue(dictionary.burstLossCount)) {
1610 auto burstLossCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstLossCount));
1611 RETURN_IF_EXCEPTION(throwScope, { });
1612 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossCount"), burstLossCountValue);
1613 }
1614 if (!IDLDouble::isNullValue(dictionary.burstLossRate)) {
1615 auto burstLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstLossRate));
1616 RETURN_IF_EXCEPTION(throwScope, { });
1617 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossRate"), burstLossRateValue);
1618 }
1619 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsDiscarded)) {
1620 auto burstPacketsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsDiscarded));
1621 RETURN_IF_EXCEPTION(throwScope, { });
1622 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsDiscarded"), burstPacketsDiscardedValue);
1623 }
1624 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsLost)) {
1625 auto burstPacketsLostValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsLost));
1626 RETURN_IF_EXCEPTION(throwScope, { });
1627 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsLost"), burstPacketsLostValue);
1628 }
1629 if (!IDLUnsignedLong::isNullValue(dictionary.framesDropped)) {
1630 auto framesDroppedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDropped));
1631 RETURN_IF_EXCEPTION(throwScope, { });
1632 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDropped"), framesDroppedValue);
1633 }
1634 if (!IDLUnsignedLong::isNullValue(dictionary.fullFramesLost)) {
1635 auto fullFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.fullFramesLost));
1636 RETURN_IF_EXCEPTION(throwScope, { });
1637 result->putDirect(vm, JSC::Identifier::fromString(vm, "fullFramesLost"), fullFramesLostValue);
1638 }
1639 if (!IDLDouble::isNullValue(dictionary.gapDiscardRate)) {
1640 auto gapDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapDiscardRate));
1641 RETURN_IF_EXCEPTION(throwScope, { });
1642 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapDiscardRate"), gapDiscardRateValue);
1643 }
1644 if (!IDLDouble::isNullValue(dictionary.gapLossRate)) {
1645 auto gapLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapLossRate));
1646 RETURN_IF_EXCEPTION(throwScope, { });
1647 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapLossRate"), gapLossRateValue);
1648 }
1649 if (!IDLDouble::isNullValue(dictionary.jitter)) {
1650 auto jitterValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.jitter));
1651 RETURN_IF_EXCEPTION(throwScope, { });
1652 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitter"), jitterValue);
1653 }
1654 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsDiscarded)) {
1655 auto packetsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsDiscarded));
1656 RETURN_IF_EXCEPTION(throwScope, { });
1657 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsDiscarded"), packetsDiscardedValue);
1658 }
1659 if (!IDLLongLong::isNullValue(dictionary.packetsLost)) {
1660 auto packetsLostValue = toJS<IDLLongLong>(lexicalGlobalObject, throwScope, IDLLongLong::extractValueFromNullable(dictionary.packetsLost));
1661 RETURN_IF_EXCEPTION(throwScope, { });
1662 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsLost"), packetsLostValue);
1663 }
1664 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsReceived)) {
1665 auto packetsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsReceived));
1666 RETURN_IF_EXCEPTION(throwScope, { });
1667 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsReceived"), packetsReceivedValue);
1668 }
1669 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsRepaired)) {
1670 auto packetsRepairedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsRepaired));
1671 RETURN_IF_EXCEPTION(throwScope, { });
1672 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsRepaired"), packetsRepairedValue);
1673 }
1674 if (!IDLUnsignedLong::isNullValue(dictionary.partialFramesLost)) {
1675 auto partialFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.partialFramesLost));
1676 RETURN_IF_EXCEPTION(throwScope, { });
1677 result->putDirect(vm, JSC::Identifier::fromString(vm, "partialFramesLost"), partialFramesLostValue);
1678 }
1679 if (!IDLDouble::isNullValue(dictionary.audioLevel)) {
1680 auto audioLevelValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.audioLevel));
1681 RETURN_IF_EXCEPTION(throwScope, { });
1682 result->putDirect(vm, JSC::Identifier::fromString(vm, "audioLevel"), audioLevelValue);
1683 }
1684 if (!IDLDouble::isNullValue(dictionary.averageRtcpInterval)) {
1685 auto averageRtcpIntervalValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.averageRtcpInterval));
1686 RETURN_IF_EXCEPTION(throwScope, { });
1687 result->putDirect(vm, JSC::Identifier::fromString(vm, "averageRtcpInterval"), averageRtcpIntervalValue);
1688 }
1689 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesReceived)) {
1690 auto bytesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesReceived));
1691 RETURN_IF_EXCEPTION(throwScope, { });
1692 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesReceived"), bytesReceivedValue);
1693 }
1694 if (!IDLUnsignedLongLong::isNullValue(dictionary.concealedSamples)) {
1695 auto concealedSamplesValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.concealedSamples));
1696 RETURN_IF_EXCEPTION(throwScope, { });
1697 result->putDirect(vm, JSC::Identifier::fromString(vm, "concealedSamples"), concealedSamplesValue);
1698 }
1699 if (!IDLUnsignedLongLong::isNullValue(dictionary.concealmentEvents)) {
1700 auto concealmentEventsValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.concealmentEvents));
1701 RETURN_IF_EXCEPTION(throwScope, { });
1702 result->putDirect(vm, JSC::Identifier::fromString(vm, "concealmentEvents"), concealmentEventsValue);
1703 }
1704 if (!IDLDouble::isNullValue(dictionary.estimatedPlayoutTimestamp)) {
1705 auto estimatedPlayoutTimestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.estimatedPlayoutTimestamp));
1706 RETURN_IF_EXCEPTION(throwScope, { });
1707 result->putDirect(vm, JSC::Identifier::fromString(vm, "estimatedPlayoutTimestamp"), estimatedPlayoutTimestampValue);
1708 }
1709 if (!IDLUnsignedLongLong::isNullValue(dictionary.fecPacketsDiscarded)) {
1710 auto fecPacketsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.fecPacketsDiscarded));
1711 RETURN_IF_EXCEPTION(throwScope, { });
1712 result->putDirect(vm, JSC::Identifier::fromString(vm, "fecPacketsDiscarded"), fecPacketsDiscardedValue);
1713 }
1714 if (!IDLUnsignedLongLong::isNullValue(dictionary.fecPacketsReceived)) {
1715 auto fecPacketsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.fecPacketsReceived));
1716 RETURN_IF_EXCEPTION(throwScope, { });
1717 result->putDirect(vm, JSC::Identifier::fromString(vm, "fecPacketsReceived"), fecPacketsReceivedValue);
1718 }
1719 if (!IDLUnsignedLong::isNullValue(dictionary.firCount)) {
1720 auto firCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.firCount));
1721 RETURN_IF_EXCEPTION(throwScope, { });
1722 result->putDirect(vm, JSC::Identifier::fromString(vm, "firCount"), firCountValue);
1723 }
1724 if (!IDLUnsignedLong::isNullValue(dictionary.frameBitDepth)) {
1725 auto frameBitDepthValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameBitDepth));
1726 RETURN_IF_EXCEPTION(throwScope, { });
1727 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameBitDepth"), frameBitDepthValue);
1728 }
1729 if (!IDLUnsignedLong::isNullValue(dictionary.frameHeight)) {
1730 auto frameHeightValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameHeight));
1731 RETURN_IF_EXCEPTION(throwScope, { });
1732 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameHeight"), frameHeightValue);
1733 }
1734 if (!IDLUnsignedLong::isNullValue(dictionary.frameWidth)) {
1735 auto frameWidthValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameWidth));
1736 RETURN_IF_EXCEPTION(throwScope, { });
1737 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameWidth"), frameWidthValue);
1738 }
1739 if (!IDLUnsignedLong::isNullValue(dictionary.framesDecoded)) {
1740 auto framesDecodedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDecoded));
1741 RETURN_IF_EXCEPTION(throwScope, { });
1742 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDecoded"), framesDecodedValue);
1743 }
1744 if (!IDLDouble::isNullValue(dictionary.framesPerSecond)) {
1745 auto framesPerSecondValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.framesPerSecond));
1746 RETURN_IF_EXCEPTION(throwScope, { });
1747 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesPerSecond"), framesPerSecondValue);
1748 }
1749 if (!IDLUnsignedLong::isNullValue(dictionary.framesReceived)) {
1750 auto framesReceivedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesReceived));
1751 RETURN_IF_EXCEPTION(throwScope, { });
1752 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesReceived"), framesReceivedValue);
1753 }
1754 if (!IDLUnsignedLongLong::isNullValue(dictionary.headerBytesReceived)) {
1755 auto headerBytesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.headerBytesReceived));
1756 RETURN_IF_EXCEPTION(throwScope, { });
1757 result->putDirect(vm, JSC::Identifier::fromString(vm, "headerBytesReceived"), headerBytesReceivedValue);
1758 }
1759 if (!IDLUnsignedLongLong::isNullValue(dictionary.insertedSamplesForDeceleration)) {
1760 auto insertedSamplesForDecelerationValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.insertedSamplesForDeceleration));
1761 RETURN_IF_EXCEPTION(throwScope, { });
1762 result->putDirect(vm, JSC::Identifier::fromString(vm, "insertedSamplesForDeceleration"), insertedSamplesForDecelerationValue);
1763 }
1764 if (!IDLDouble::isNullValue(dictionary.jitterBufferDelay)) {
1765 auto jitterBufferDelayValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.jitterBufferDelay));
1766 RETURN_IF_EXCEPTION(throwScope, { });
1767 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitterBufferDelay"), jitterBufferDelayValue);
1768 }
1769 if (!IDLUnsignedLongLong::isNullValue(dictionary.jitterBufferEmittedCount)) {
1770 auto jitterBufferEmittedCountValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.jitterBufferEmittedCount));
1771 RETURN_IF_EXCEPTION(throwScope, { });
1772 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitterBufferEmittedCount"), jitterBufferEmittedCountValue);
1773 }
1774 if (!IDLUnsignedLong::isNullValue(dictionary.keyFramesDecoded)) {
1775 auto keyFramesDecodedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.keyFramesDecoded));
1776 RETURN_IF_EXCEPTION(throwScope, { });
1777 result->putDirect(vm, JSC::Identifier::fromString(vm, "keyFramesDecoded"), keyFramesDecodedValue);
1778 }
1779 if (!IDLDouble::isNullValue(dictionary.lastPacketReceivedTimestamp)) {
1780 auto lastPacketReceivedTimestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.lastPacketReceivedTimestamp));
1781 RETURN_IF_EXCEPTION(throwScope, { });
1782 result->putDirect(vm, JSC::Identifier::fromString(vm, "lastPacketReceivedTimestamp"), lastPacketReceivedTimestampValue);
1783 }
1784 if (!IDLUnsignedLong::isNullValue(dictionary.nackCount)) {
1785 auto nackCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.nackCount));
1786 RETURN_IF_EXCEPTION(throwScope, { });
1787 result->putDirect(vm, JSC::Identifier::fromString(vm, "nackCount"), nackCountValue);
1788 }
1789 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsDuplicated)) {
1790 auto packetsDuplicatedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsDuplicated));
1791 RETURN_IF_EXCEPTION(throwScope, { });
1792 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsDuplicated"), packetsDuplicatedValue);
1793 }
1794 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsFailedDecryption)) {
1795 auto packetsFailedDecryptionValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsFailedDecryption));
1796 RETURN_IF_EXCEPTION(throwScope, { });
1797 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsFailedDecryption"), packetsFailedDecryptionValue);
1798 }
1799 if (!IDLUnsignedLong::isNullValue(dictionary.pliCount)) {
1800 auto pliCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.pliCount));
1801 RETURN_IF_EXCEPTION(throwScope, { });
1802 result->putDirect(vm, JSC::Identifier::fromString(vm, "pliCount"), pliCountValue);
1803 }
1804 if (!IDLUnsignedLongLong::isNullValue(dictionary.qpSum)) {
1805 auto qpSumValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.qpSum));
1806 RETURN_IF_EXCEPTION(throwScope, { });
1807 result->putDirect(vm, JSC::Identifier::fromString(vm, "qpSum"), qpSumValue);
1808 }
1809 if (!IDLDOMString::isNullValue(dictionary.remoteId)) {
1810 auto remoteIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.remoteId));
1811 RETURN_IF_EXCEPTION(throwScope, { });
1812 result->putDirect(vm, JSC::Identifier::fromString(vm, "remoteId"), remoteIdValue);
1813 }
1814 if (!IDLUnsignedLongLong::isNullValue(dictionary.removedSamplesForAcceleration)) {
1815 auto removedSamplesForAccelerationValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.removedSamplesForAcceleration));
1816 RETURN_IF_EXCEPTION(throwScope, { });
1817 result->putDirect(vm, JSC::Identifier::fromString(vm, "removedSamplesForAcceleration"), removedSamplesForAccelerationValue);
1818 }
1819 if (!IDLUnsignedLongLong::isNullValue(dictionary.samplesDecodedWithCelt)) {
1820 auto samplesDecodedWithCeltValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.samplesDecodedWithCelt));
1821 RETURN_IF_EXCEPTION(throwScope, { });
1822 result->putDirect(vm, JSC::Identifier::fromString(vm, "samplesDecodedWithCelt"), samplesDecodedWithCeltValue);
1823 }
1824 if (!IDLUnsignedLongLong::isNullValue(dictionary.samplesDecodedWithSilk)) {
1825 auto samplesDecodedWithSilkValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.samplesDecodedWithSilk));
1826 RETURN_IF_EXCEPTION(throwScope, { });
1827 result->putDirect(vm, JSC::Identifier::fromString(vm, "samplesDecodedWithSilk"), samplesDecodedWithSilkValue);
1828 }
1829 if (!IDLUnsignedLongLong::isNullValue(dictionary.silentConcealedSamples)) {
1830 auto silentConcealedSamplesValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.silentConcealedSamples));
1831 RETURN_IF_EXCEPTION(throwScope, { });
1832 result->putDirect(vm, JSC::Identifier::fromString(vm, "silentConcealedSamples"), silentConcealedSamplesValue);
1833 }
1834 if (!IDLUnsignedLong::isNullValue(dictionary.sliCount)) {
1835 auto sliCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.sliCount));
1836 RETURN_IF_EXCEPTION(throwScope, { });
1837 result->putDirect(vm, JSC::Identifier::fromString(vm, "sliCount"), sliCountValue);
1838 }
1839 if (!IDLDouble::isNullValue(dictionary.totalAudioEnergy)) {
1840 auto totalAudioEnergyValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalAudioEnergy));
1841 RETURN_IF_EXCEPTION(throwScope, { });
1842 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalAudioEnergy"), totalAudioEnergyValue);
1843 }
1844 if (!IDLDouble::isNullValue(dictionary.totalDecodeTime)) {
1845 auto totalDecodeTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalDecodeTime));
1846 RETURN_IF_EXCEPTION(throwScope, { });
1847 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalDecodeTime"), totalDecodeTimeValue);
1848 }
1849 if (!IDLDouble::isNullValue(dictionary.totalInterFrameDelay)) {
1850 auto totalInterFrameDelayValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalInterFrameDelay));
1851 RETURN_IF_EXCEPTION(throwScope, { });
1852 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalInterFrameDelay"), totalInterFrameDelayValue);
1853 }
1854 if (!IDLDouble::isNullValue(dictionary.totalSamplesDuration)) {
1855 auto totalSamplesDurationValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalSamplesDuration));
1856 RETURN_IF_EXCEPTION(throwScope, { });
1857 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalSamplesDuration"), totalSamplesDurationValue);
1858 }
1859 if (!IDLUnsignedLongLong::isNullValue(dictionary.totalSamplesReceived)) {
1860 auto totalSamplesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.totalSamplesReceived));
1861 RETURN_IF_EXCEPTION(throwScope, { });
1862 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalSamplesReceived"), totalSamplesReceivedValue);
1863 }
1864 if (!IDLDouble::isNullValue(dictionary.totalSquaredInterFrameDelay)) {
1865 auto totalSquaredInterFrameDelayValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalSquaredInterFrameDelay));
1866 RETURN_IF_EXCEPTION(throwScope, { });
1867 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalSquaredInterFrameDelay"), totalSquaredInterFrameDelayValue);
1868 }
1869 if (!IDLDOMString::isNullValue(dictionary.trackId)) {
1870 auto trackIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.trackId));
1871 RETURN_IF_EXCEPTION(throwScope, { });
1872 result->putDirect(vm, JSC::Identifier::fromString(vm, "trackId"), trackIdValue);
1873 }
1874 if (!IDLBoolean::isNullValue(dictionary.voiceActivityFlag)) {
1875 auto voiceActivityFlagValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.voiceActivityFlag));
1876 RETURN_IF_EXCEPTION(throwScope, { });
1877 result->putDirect(vm, JSC::Identifier::fromString(vm, "voiceActivityFlag"), voiceActivityFlagValue);
1878 }
1879 return result;
1880}
1881
1882template<> RTCStatsReport::RemoteInboundRtpStreamStats convertDictionary<RTCStatsReport::RemoteInboundRtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
1883{
1884 VM& vm = JSC::getVM(&lexicalGlobalObject);
1885 auto throwScope = DECLARE_THROW_SCOPE(vm);
1886 bool isNullOrUndefined = value.isUndefinedOrNull();
1887 auto* object = isNullOrUndefined ? nullptr : value.getObject();
1888 if (UNLIKELY(!isNullOrUndefined && !object)) {
1889 throwTypeError(&lexicalGlobalObject, throwScope);
1890 return { };
1891 }
1892 RTCStatsReport::RemoteInboundRtpStreamStats result;
1893 JSValue idValue;
1894 if (isNullOrUndefined)
1895 idValue = jsUndefined();
1896 else {
1897 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
1898 RETURN_IF_EXCEPTION(throwScope, { });
1899 }
1900 if (!idValue.isUndefined()) {
1901 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
1902 RETURN_IF_EXCEPTION(throwScope, { });
1903 }
1904 JSValue timestampValue;
1905 if (isNullOrUndefined)
1906 timestampValue = jsUndefined();
1907 else {
1908 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
1909 RETURN_IF_EXCEPTION(throwScope, { });
1910 }
1911 if (!timestampValue.isUndefined()) {
1912 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
1913 RETURN_IF_EXCEPTION(throwScope, { });
1914 }
1915 JSValue typeValue;
1916 if (isNullOrUndefined)
1917 typeValue = jsUndefined();
1918 else {
1919 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
1920 RETURN_IF_EXCEPTION(throwScope, { });
1921 }
1922 if (!typeValue.isUndefined()) {
1923 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
1924 RETURN_IF_EXCEPTION(throwScope, { });
1925 }
1926 JSValue codecIdValue;
1927 if (isNullOrUndefined)
1928 codecIdValue = jsUndefined();
1929 else {
1930 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
1931 RETURN_IF_EXCEPTION(throwScope, { });
1932 }
1933 if (!codecIdValue.isUndefined()) {
1934 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
1935 RETURN_IF_EXCEPTION(throwScope, { });
1936 }
1937 JSValue kindValue;
1938 if (isNullOrUndefined)
1939 kindValue = jsUndefined();
1940 else {
1941 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
1942 RETURN_IF_EXCEPTION(throwScope, { });
1943 }
1944 if (!kindValue.isUndefined()) {
1945 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
1946 RETURN_IF_EXCEPTION(throwScope, { });
1947 } else {
1948 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCRemoteInboundRtpStreamStats", "DOMString");
1949 return { };
1950 }
1951 JSValue mediaTypeValue;
1952 if (isNullOrUndefined)
1953 mediaTypeValue = jsUndefined();
1954 else {
1955 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
1956 RETURN_IF_EXCEPTION(throwScope, { });
1957 }
1958 if (!mediaTypeValue.isUndefined()) {
1959 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
1960 RETURN_IF_EXCEPTION(throwScope, { });
1961 } else {
1962 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCRemoteInboundRtpStreamStats", "DOMString");
1963 return { };
1964 }
1965 JSValue ssrcValue;
1966 if (isNullOrUndefined)
1967 ssrcValue = jsUndefined();
1968 else {
1969 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
1970 RETURN_IF_EXCEPTION(throwScope, { });
1971 }
1972 if (!ssrcValue.isUndefined()) {
1973 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
1974 RETURN_IF_EXCEPTION(throwScope, { });
1975 } else {
1976 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCRemoteInboundRtpStreamStats", "unsigned long");
1977 return { };
1978 }
1979 JSValue transportIdValue;
1980 if (isNullOrUndefined)
1981 transportIdValue = jsUndefined();
1982 else {
1983 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
1984 RETURN_IF_EXCEPTION(throwScope, { });
1985 }
1986 if (!transportIdValue.isUndefined()) {
1987 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
1988 RETURN_IF_EXCEPTION(throwScope, { });
1989 }
1990 JSValue burstDiscardCountValue;
1991 if (isNullOrUndefined)
1992 burstDiscardCountValue = jsUndefined();
1993 else {
1994 burstDiscardCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardCount"));
1995 RETURN_IF_EXCEPTION(throwScope, { });
1996 }
1997 if (!burstDiscardCountValue.isUndefined()) {
1998 result.burstDiscardCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstDiscardCountValue);
1999 RETURN_IF_EXCEPTION(throwScope, { });
2000 }
2001 JSValue burstDiscardRateValue;
2002 if (isNullOrUndefined)
2003 burstDiscardRateValue = jsUndefined();
2004 else {
2005 burstDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstDiscardRate"));
2006 RETURN_IF_EXCEPTION(throwScope, { });
2007 }
2008 if (!burstDiscardRateValue.isUndefined()) {
2009 result.burstDiscardRate = convert<IDLDouble>(lexicalGlobalObject, burstDiscardRateValue);
2010 RETURN_IF_EXCEPTION(throwScope, { });
2011 }
2012 JSValue burstLossCountValue;
2013 if (isNullOrUndefined)
2014 burstLossCountValue = jsUndefined();
2015 else {
2016 burstLossCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossCount"));
2017 RETURN_IF_EXCEPTION(throwScope, { });
2018 }
2019 if (!burstLossCountValue.isUndefined()) {
2020 result.burstLossCount = convert<IDLUnsignedLong>(lexicalGlobalObject, burstLossCountValue);
2021 RETURN_IF_EXCEPTION(throwScope, { });
2022 }
2023 JSValue burstLossRateValue;
2024 if (isNullOrUndefined)
2025 burstLossRateValue = jsUndefined();
2026 else {
2027 burstLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstLossRate"));
2028 RETURN_IF_EXCEPTION(throwScope, { });
2029 }
2030 if (!burstLossRateValue.isUndefined()) {
2031 result.burstLossRate = convert<IDLDouble>(lexicalGlobalObject, burstLossRateValue);
2032 RETURN_IF_EXCEPTION(throwScope, { });
2033 }
2034 JSValue burstPacketsDiscardedValue;
2035 if (isNullOrUndefined)
2036 burstPacketsDiscardedValue = jsUndefined();
2037 else {
2038 burstPacketsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsDiscarded"));
2039 RETURN_IF_EXCEPTION(throwScope, { });
2040 }
2041 if (!burstPacketsDiscardedValue.isUndefined()) {
2042 result.burstPacketsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsDiscardedValue);
2043 RETURN_IF_EXCEPTION(throwScope, { });
2044 }
2045 JSValue burstPacketsLostValue;
2046 if (isNullOrUndefined)
2047 burstPacketsLostValue = jsUndefined();
2048 else {
2049 burstPacketsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "burstPacketsLost"));
2050 RETURN_IF_EXCEPTION(throwScope, { });
2051 }
2052 if (!burstPacketsLostValue.isUndefined()) {
2053 result.burstPacketsLost = convert<IDLUnsignedLongLong>(lexicalGlobalObject, burstPacketsLostValue);
2054 RETURN_IF_EXCEPTION(throwScope, { });
2055 }
2056 JSValue framesDroppedValue;
2057 if (isNullOrUndefined)
2058 framesDroppedValue = jsUndefined();
2059 else {
2060 framesDroppedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDropped"));
2061 RETURN_IF_EXCEPTION(throwScope, { });
2062 }
2063 if (!framesDroppedValue.isUndefined()) {
2064 result.framesDropped = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDroppedValue);
2065 RETURN_IF_EXCEPTION(throwScope, { });
2066 }
2067 JSValue fullFramesLostValue;
2068 if (isNullOrUndefined)
2069 fullFramesLostValue = jsUndefined();
2070 else {
2071 fullFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fullFramesLost"));
2072 RETURN_IF_EXCEPTION(throwScope, { });
2073 }
2074 if (!fullFramesLostValue.isUndefined()) {
2075 result.fullFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, fullFramesLostValue);
2076 RETURN_IF_EXCEPTION(throwScope, { });
2077 }
2078 JSValue gapDiscardRateValue;
2079 if (isNullOrUndefined)
2080 gapDiscardRateValue = jsUndefined();
2081 else {
2082 gapDiscardRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapDiscardRate"));
2083 RETURN_IF_EXCEPTION(throwScope, { });
2084 }
2085 if (!gapDiscardRateValue.isUndefined()) {
2086 result.gapDiscardRate = convert<IDLDouble>(lexicalGlobalObject, gapDiscardRateValue);
2087 RETURN_IF_EXCEPTION(throwScope, { });
2088 }
2089 JSValue gapLossRateValue;
2090 if (isNullOrUndefined)
2091 gapLossRateValue = jsUndefined();
2092 else {
2093 gapLossRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "gapLossRate"));
2094 RETURN_IF_EXCEPTION(throwScope, { });
2095 }
2096 if (!gapLossRateValue.isUndefined()) {
2097 result.gapLossRate = convert<IDLDouble>(lexicalGlobalObject, gapLossRateValue);
2098 RETURN_IF_EXCEPTION(throwScope, { });
2099 }
2100 JSValue jitterValue;
2101 if (isNullOrUndefined)
2102 jitterValue = jsUndefined();
2103 else {
2104 jitterValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitter"));
2105 RETURN_IF_EXCEPTION(throwScope, { });
2106 }
2107 if (!jitterValue.isUndefined()) {
2108 result.jitter = convert<IDLDouble>(lexicalGlobalObject, jitterValue);
2109 RETURN_IF_EXCEPTION(throwScope, { });
2110 }
2111 JSValue packetsDiscardedValue;
2112 if (isNullOrUndefined)
2113 packetsDiscardedValue = jsUndefined();
2114 else {
2115 packetsDiscardedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsDiscarded"));
2116 RETURN_IF_EXCEPTION(throwScope, { });
2117 }
2118 if (!packetsDiscardedValue.isUndefined()) {
2119 result.packetsDiscarded = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsDiscardedValue);
2120 RETURN_IF_EXCEPTION(throwScope, { });
2121 }
2122 JSValue packetsLostValue;
2123 if (isNullOrUndefined)
2124 packetsLostValue = jsUndefined();
2125 else {
2126 packetsLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsLost"));
2127 RETURN_IF_EXCEPTION(throwScope, { });
2128 }
2129 if (!packetsLostValue.isUndefined()) {
2130 result.packetsLost = convert<IDLLongLong>(lexicalGlobalObject, packetsLostValue);
2131 RETURN_IF_EXCEPTION(throwScope, { });
2132 }
2133 JSValue packetsReceivedValue;
2134 if (isNullOrUndefined)
2135 packetsReceivedValue = jsUndefined();
2136 else {
2137 packetsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsReceived"));
2138 RETURN_IF_EXCEPTION(throwScope, { });
2139 }
2140 if (!packetsReceivedValue.isUndefined()) {
2141 result.packetsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsReceivedValue);
2142 RETURN_IF_EXCEPTION(throwScope, { });
2143 }
2144 JSValue packetsRepairedValue;
2145 if (isNullOrUndefined)
2146 packetsRepairedValue = jsUndefined();
2147 else {
2148 packetsRepairedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsRepaired"));
2149 RETURN_IF_EXCEPTION(throwScope, { });
2150 }
2151 if (!packetsRepairedValue.isUndefined()) {
2152 result.packetsRepaired = convert<IDLUnsignedLongLong>(lexicalGlobalObject, packetsRepairedValue);
2153 RETURN_IF_EXCEPTION(throwScope, { });
2154 }
2155 JSValue partialFramesLostValue;
2156 if (isNullOrUndefined)
2157 partialFramesLostValue = jsUndefined();
2158 else {
2159 partialFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialFramesLost"));
2160 RETURN_IF_EXCEPTION(throwScope, { });
2161 }
2162 if (!partialFramesLostValue.isUndefined()) {
2163 result.partialFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, partialFramesLostValue);
2164 RETURN_IF_EXCEPTION(throwScope, { });
2165 }
2166 JSValue fractionLostValue;
2167 if (isNullOrUndefined)
2168 fractionLostValue = jsUndefined();
2169 else {
2170 fractionLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fractionLost"));
2171 RETURN_IF_EXCEPTION(throwScope, { });
2172 }
2173 if (!fractionLostValue.isUndefined()) {
2174 result.fractionLost = convert<IDLDouble>(lexicalGlobalObject, fractionLostValue);
2175 RETURN_IF_EXCEPTION(throwScope, { });
2176 }
2177 JSValue localIdValue;
2178 if (isNullOrUndefined)
2179 localIdValue = jsUndefined();
2180 else {
2181 localIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "localId"));
2182 RETURN_IF_EXCEPTION(throwScope, { });
2183 }
2184 if (!localIdValue.isUndefined()) {
2185 result.localId = convert<IDLDOMString>(lexicalGlobalObject, localIdValue);
2186 RETURN_IF_EXCEPTION(throwScope, { });
2187 }
2188 JSValue reportsReceivedValue;
2189 if (isNullOrUndefined)
2190 reportsReceivedValue = jsUndefined();
2191 else {
2192 reportsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "reportsReceived"));
2193 RETURN_IF_EXCEPTION(throwScope, { });
2194 }
2195 if (!reportsReceivedValue.isUndefined()) {
2196 result.reportsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, reportsReceivedValue);
2197 RETURN_IF_EXCEPTION(throwScope, { });
2198 }
2199 JSValue roundTripTimeValue;
2200 if (isNullOrUndefined)
2201 roundTripTimeValue = jsUndefined();
2202 else {
2203 roundTripTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "roundTripTime"));
2204 RETURN_IF_EXCEPTION(throwScope, { });
2205 }
2206 if (!roundTripTimeValue.isUndefined()) {
2207 result.roundTripTime = convert<IDLDouble>(lexicalGlobalObject, roundTripTimeValue);
2208 RETURN_IF_EXCEPTION(throwScope, { });
2209 }
2210 JSValue roundTripTimeMeasurementsValue;
2211 if (isNullOrUndefined)
2212 roundTripTimeMeasurementsValue = jsUndefined();
2213 else {
2214 roundTripTimeMeasurementsValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "roundTripTimeMeasurements"));
2215 RETURN_IF_EXCEPTION(throwScope, { });
2216 }
2217 if (!roundTripTimeMeasurementsValue.isUndefined()) {
2218 result.roundTripTimeMeasurements = convert<IDLUnsignedLongLong>(lexicalGlobalObject, roundTripTimeMeasurementsValue);
2219 RETURN_IF_EXCEPTION(throwScope, { });
2220 }
2221 JSValue totalRoundTripTimeValue;
2222 if (isNullOrUndefined)
2223 totalRoundTripTimeValue = jsUndefined();
2224 else {
2225 totalRoundTripTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalRoundTripTime"));
2226 RETURN_IF_EXCEPTION(throwScope, { });
2227 }
2228 if (!totalRoundTripTimeValue.isUndefined()) {
2229 result.totalRoundTripTime = convert<IDLDouble>(lexicalGlobalObject, totalRoundTripTimeValue);
2230 RETURN_IF_EXCEPTION(throwScope, { });
2231 }
2232 return result;
2233}
2234
2235JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::RemoteInboundRtpStreamStats& dictionary)
2236{
2237 auto& vm = JSC::getVM(&lexicalGlobalObject);
2238 auto throwScope = DECLARE_THROW_SCOPE(vm);
2239
2240 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
2241
2242 if (!IDLDOMString::isNullValue(dictionary.id)) {
2243 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
2244 RETURN_IF_EXCEPTION(throwScope, { });
2245 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
2246 }
2247 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
2248 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
2249 RETURN_IF_EXCEPTION(throwScope, { });
2250 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
2251 }
2252 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
2253 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
2254 RETURN_IF_EXCEPTION(throwScope, { });
2255 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
2256 }
2257 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
2258 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
2259 RETURN_IF_EXCEPTION(throwScope, { });
2260 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
2261 }
2262 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
2263 RETURN_IF_EXCEPTION(throwScope, { });
2264 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
2265 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
2266 RETURN_IF_EXCEPTION(throwScope, { });
2267 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
2268 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
2269 RETURN_IF_EXCEPTION(throwScope, { });
2270 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
2271 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
2272 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
2273 RETURN_IF_EXCEPTION(throwScope, { });
2274 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
2275 }
2276 if (!IDLUnsignedLong::isNullValue(dictionary.burstDiscardCount)) {
2277 auto burstDiscardCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstDiscardCount));
2278 RETURN_IF_EXCEPTION(throwScope, { });
2279 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardCount"), burstDiscardCountValue);
2280 }
2281 if (!IDLDouble::isNullValue(dictionary.burstDiscardRate)) {
2282 auto burstDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstDiscardRate));
2283 RETURN_IF_EXCEPTION(throwScope, { });
2284 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstDiscardRate"), burstDiscardRateValue);
2285 }
2286 if (!IDLUnsignedLong::isNullValue(dictionary.burstLossCount)) {
2287 auto burstLossCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.burstLossCount));
2288 RETURN_IF_EXCEPTION(throwScope, { });
2289 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossCount"), burstLossCountValue);
2290 }
2291 if (!IDLDouble::isNullValue(dictionary.burstLossRate)) {
2292 auto burstLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.burstLossRate));
2293 RETURN_IF_EXCEPTION(throwScope, { });
2294 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstLossRate"), burstLossRateValue);
2295 }
2296 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsDiscarded)) {
2297 auto burstPacketsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsDiscarded));
2298 RETURN_IF_EXCEPTION(throwScope, { });
2299 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsDiscarded"), burstPacketsDiscardedValue);
2300 }
2301 if (!IDLUnsignedLongLong::isNullValue(dictionary.burstPacketsLost)) {
2302 auto burstPacketsLostValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.burstPacketsLost));
2303 RETURN_IF_EXCEPTION(throwScope, { });
2304 result->putDirect(vm, JSC::Identifier::fromString(vm, "burstPacketsLost"), burstPacketsLostValue);
2305 }
2306 if (!IDLUnsignedLong::isNullValue(dictionary.framesDropped)) {
2307 auto framesDroppedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDropped));
2308 RETURN_IF_EXCEPTION(throwScope, { });
2309 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDropped"), framesDroppedValue);
2310 }
2311 if (!IDLUnsignedLong::isNullValue(dictionary.fullFramesLost)) {
2312 auto fullFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.fullFramesLost));
2313 RETURN_IF_EXCEPTION(throwScope, { });
2314 result->putDirect(vm, JSC::Identifier::fromString(vm, "fullFramesLost"), fullFramesLostValue);
2315 }
2316 if (!IDLDouble::isNullValue(dictionary.gapDiscardRate)) {
2317 auto gapDiscardRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapDiscardRate));
2318 RETURN_IF_EXCEPTION(throwScope, { });
2319 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapDiscardRate"), gapDiscardRateValue);
2320 }
2321 if (!IDLDouble::isNullValue(dictionary.gapLossRate)) {
2322 auto gapLossRateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.gapLossRate));
2323 RETURN_IF_EXCEPTION(throwScope, { });
2324 result->putDirect(vm, JSC::Identifier::fromString(vm, "gapLossRate"), gapLossRateValue);
2325 }
2326 if (!IDLDouble::isNullValue(dictionary.jitter)) {
2327 auto jitterValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.jitter));
2328 RETURN_IF_EXCEPTION(throwScope, { });
2329 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitter"), jitterValue);
2330 }
2331 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsDiscarded)) {
2332 auto packetsDiscardedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsDiscarded));
2333 RETURN_IF_EXCEPTION(throwScope, { });
2334 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsDiscarded"), packetsDiscardedValue);
2335 }
2336 if (!IDLLongLong::isNullValue(dictionary.packetsLost)) {
2337 auto packetsLostValue = toJS<IDLLongLong>(lexicalGlobalObject, throwScope, IDLLongLong::extractValueFromNullable(dictionary.packetsLost));
2338 RETURN_IF_EXCEPTION(throwScope, { });
2339 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsLost"), packetsLostValue);
2340 }
2341 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsReceived)) {
2342 auto packetsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsReceived));
2343 RETURN_IF_EXCEPTION(throwScope, { });
2344 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsReceived"), packetsReceivedValue);
2345 }
2346 if (!IDLUnsignedLongLong::isNullValue(dictionary.packetsRepaired)) {
2347 auto packetsRepairedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.packetsRepaired));
2348 RETURN_IF_EXCEPTION(throwScope, { });
2349 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsRepaired"), packetsRepairedValue);
2350 }
2351 if (!IDLUnsignedLong::isNullValue(dictionary.partialFramesLost)) {
2352 auto partialFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.partialFramesLost));
2353 RETURN_IF_EXCEPTION(throwScope, { });
2354 result->putDirect(vm, JSC::Identifier::fromString(vm, "partialFramesLost"), partialFramesLostValue);
2355 }
2356 if (!IDLDouble::isNullValue(dictionary.fractionLost)) {
2357 auto fractionLostValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.fractionLost));
2358 RETURN_IF_EXCEPTION(throwScope, { });
2359 result->putDirect(vm, JSC::Identifier::fromString(vm, "fractionLost"), fractionLostValue);
2360 }
2361 if (!IDLDOMString::isNullValue(dictionary.localId)) {
2362 auto localIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.localId));
2363 RETURN_IF_EXCEPTION(throwScope, { });
2364 result->putDirect(vm, JSC::Identifier::fromString(vm, "localId"), localIdValue);
2365 }
2366 if (!IDLUnsignedLongLong::isNullValue(dictionary.reportsReceived)) {
2367 auto reportsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.reportsReceived));
2368 RETURN_IF_EXCEPTION(throwScope, { });
2369 result->putDirect(vm, JSC::Identifier::fromString(vm, "reportsReceived"), reportsReceivedValue);
2370 }
2371 if (!IDLDouble::isNullValue(dictionary.roundTripTime)) {
2372 auto roundTripTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.roundTripTime));
2373 RETURN_IF_EXCEPTION(throwScope, { });
2374 result->putDirect(vm, JSC::Identifier::fromString(vm, "roundTripTime"), roundTripTimeValue);
2375 }
2376 if (!IDLUnsignedLongLong::isNullValue(dictionary.roundTripTimeMeasurements)) {
2377 auto roundTripTimeMeasurementsValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.roundTripTimeMeasurements));
2378 RETURN_IF_EXCEPTION(throwScope, { });
2379 result->putDirect(vm, JSC::Identifier::fromString(vm, "roundTripTimeMeasurements"), roundTripTimeMeasurementsValue);
2380 }
2381 if (!IDLDouble::isNullValue(dictionary.totalRoundTripTime)) {
2382 auto totalRoundTripTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalRoundTripTime));
2383 RETURN_IF_EXCEPTION(throwScope, { });
2384 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalRoundTripTime"), totalRoundTripTimeValue);
2385 }
2386 return result;
2387}
2388
2389template<> RTCStatsReport::SentRtpStreamStats convertDictionary<RTCStatsReport::SentRtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
2390{
2391 VM& vm = JSC::getVM(&lexicalGlobalObject);
2392 auto throwScope = DECLARE_THROW_SCOPE(vm);
2393 bool isNullOrUndefined = value.isUndefinedOrNull();
2394 auto* object = isNullOrUndefined ? nullptr : value.getObject();
2395 if (UNLIKELY(!isNullOrUndefined && !object)) {
2396 throwTypeError(&lexicalGlobalObject, throwScope);
2397 return { };
2398 }
2399 RTCStatsReport::SentRtpStreamStats result;
2400 JSValue idValue;
2401 if (isNullOrUndefined)
2402 idValue = jsUndefined();
2403 else {
2404 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
2405 RETURN_IF_EXCEPTION(throwScope, { });
2406 }
2407 if (!idValue.isUndefined()) {
2408 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
2409 RETURN_IF_EXCEPTION(throwScope, { });
2410 }
2411 JSValue timestampValue;
2412 if (isNullOrUndefined)
2413 timestampValue = jsUndefined();
2414 else {
2415 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
2416 RETURN_IF_EXCEPTION(throwScope, { });
2417 }
2418 if (!timestampValue.isUndefined()) {
2419 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
2420 RETURN_IF_EXCEPTION(throwScope, { });
2421 }
2422 JSValue typeValue;
2423 if (isNullOrUndefined)
2424 typeValue = jsUndefined();
2425 else {
2426 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
2427 RETURN_IF_EXCEPTION(throwScope, { });
2428 }
2429 if (!typeValue.isUndefined()) {
2430 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
2431 RETURN_IF_EXCEPTION(throwScope, { });
2432 }
2433 JSValue codecIdValue;
2434 if (isNullOrUndefined)
2435 codecIdValue = jsUndefined();
2436 else {
2437 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
2438 RETURN_IF_EXCEPTION(throwScope, { });
2439 }
2440 if (!codecIdValue.isUndefined()) {
2441 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
2442 RETURN_IF_EXCEPTION(throwScope, { });
2443 }
2444 JSValue kindValue;
2445 if (isNullOrUndefined)
2446 kindValue = jsUndefined();
2447 else {
2448 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
2449 RETURN_IF_EXCEPTION(throwScope, { });
2450 }
2451 if (!kindValue.isUndefined()) {
2452 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
2453 RETURN_IF_EXCEPTION(throwScope, { });
2454 } else {
2455 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCSentRtpStreamStats", "DOMString");
2456 return { };
2457 }
2458 JSValue mediaTypeValue;
2459 if (isNullOrUndefined)
2460 mediaTypeValue = jsUndefined();
2461 else {
2462 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
2463 RETURN_IF_EXCEPTION(throwScope, { });
2464 }
2465 if (!mediaTypeValue.isUndefined()) {
2466 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
2467 RETURN_IF_EXCEPTION(throwScope, { });
2468 } else {
2469 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCSentRtpStreamStats", "DOMString");
2470 return { };
2471 }
2472 JSValue ssrcValue;
2473 if (isNullOrUndefined)
2474 ssrcValue = jsUndefined();
2475 else {
2476 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
2477 RETURN_IF_EXCEPTION(throwScope, { });
2478 }
2479 if (!ssrcValue.isUndefined()) {
2480 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
2481 RETURN_IF_EXCEPTION(throwScope, { });
2482 } else {
2483 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCSentRtpStreamStats", "unsigned long");
2484 return { };
2485 }
2486 JSValue transportIdValue;
2487 if (isNullOrUndefined)
2488 transportIdValue = jsUndefined();
2489 else {
2490 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
2491 RETURN_IF_EXCEPTION(throwScope, { });
2492 }
2493 if (!transportIdValue.isUndefined()) {
2494 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
2495 RETURN_IF_EXCEPTION(throwScope, { });
2496 }
2497 JSValue bytesSentValue;
2498 if (isNullOrUndefined)
2499 bytesSentValue = jsUndefined();
2500 else {
2501 bytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesSent"));
2502 RETURN_IF_EXCEPTION(throwScope, { });
2503 }
2504 if (!bytesSentValue.isUndefined()) {
2505 result.bytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesSentValue);
2506 RETURN_IF_EXCEPTION(throwScope, { });
2507 }
2508 JSValue packetsSentValue;
2509 if (isNullOrUndefined)
2510 packetsSentValue = jsUndefined();
2511 else {
2512 packetsSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsSent"));
2513 RETURN_IF_EXCEPTION(throwScope, { });
2514 }
2515 if (!packetsSentValue.isUndefined()) {
2516 result.packetsSent = convert<IDLUnsignedLong>(lexicalGlobalObject, packetsSentValue);
2517 RETURN_IF_EXCEPTION(throwScope, { });
2518 }
2519 return result;
2520}
2521
2522JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::SentRtpStreamStats& dictionary)
2523{
2524 auto& vm = JSC::getVM(&lexicalGlobalObject);
2525 auto throwScope = DECLARE_THROW_SCOPE(vm);
2526
2527 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
2528
2529 if (!IDLDOMString::isNullValue(dictionary.id)) {
2530 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
2531 RETURN_IF_EXCEPTION(throwScope, { });
2532 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
2533 }
2534 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
2535 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
2536 RETURN_IF_EXCEPTION(throwScope, { });
2537 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
2538 }
2539 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
2540 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
2541 RETURN_IF_EXCEPTION(throwScope, { });
2542 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
2543 }
2544 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
2545 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
2546 RETURN_IF_EXCEPTION(throwScope, { });
2547 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
2548 }
2549 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
2550 RETURN_IF_EXCEPTION(throwScope, { });
2551 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
2552 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
2553 RETURN_IF_EXCEPTION(throwScope, { });
2554 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
2555 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
2556 RETURN_IF_EXCEPTION(throwScope, { });
2557 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
2558 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
2559 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
2560 RETURN_IF_EXCEPTION(throwScope, { });
2561 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
2562 }
2563 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesSent)) {
2564 auto bytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesSent));
2565 RETURN_IF_EXCEPTION(throwScope, { });
2566 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesSent"), bytesSentValue);
2567 }
2568 if (!IDLUnsignedLong::isNullValue(dictionary.packetsSent)) {
2569 auto packetsSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.packetsSent));
2570 RETURN_IF_EXCEPTION(throwScope, { });
2571 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsSent"), packetsSentValue);
2572 }
2573 return result;
2574}
2575
2576template<> RTCStatsReport::OutboundRtpStreamStats convertDictionary<RTCStatsReport::OutboundRtpStreamStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
2577{
2578 VM& vm = JSC::getVM(&lexicalGlobalObject);
2579 auto throwScope = DECLARE_THROW_SCOPE(vm);
2580 bool isNullOrUndefined = value.isUndefinedOrNull();
2581 auto* object = isNullOrUndefined ? nullptr : value.getObject();
2582 if (UNLIKELY(!isNullOrUndefined && !object)) {
2583 throwTypeError(&lexicalGlobalObject, throwScope);
2584 return { };
2585 }
2586 RTCStatsReport::OutboundRtpStreamStats result;
2587 JSValue idValue;
2588 if (isNullOrUndefined)
2589 idValue = jsUndefined();
2590 else {
2591 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
2592 RETURN_IF_EXCEPTION(throwScope, { });
2593 }
2594 if (!idValue.isUndefined()) {
2595 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
2596 RETURN_IF_EXCEPTION(throwScope, { });
2597 }
2598 JSValue timestampValue;
2599 if (isNullOrUndefined)
2600 timestampValue = jsUndefined();
2601 else {
2602 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
2603 RETURN_IF_EXCEPTION(throwScope, { });
2604 }
2605 if (!timestampValue.isUndefined()) {
2606 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
2607 RETURN_IF_EXCEPTION(throwScope, { });
2608 }
2609 JSValue typeValue;
2610 if (isNullOrUndefined)
2611 typeValue = jsUndefined();
2612 else {
2613 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
2614 RETURN_IF_EXCEPTION(throwScope, { });
2615 }
2616 if (!typeValue.isUndefined()) {
2617 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
2618 RETURN_IF_EXCEPTION(throwScope, { });
2619 }
2620 JSValue codecIdValue;
2621 if (isNullOrUndefined)
2622 codecIdValue = jsUndefined();
2623 else {
2624 codecIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecId"));
2625 RETURN_IF_EXCEPTION(throwScope, { });
2626 }
2627 if (!codecIdValue.isUndefined()) {
2628 result.codecId = convert<IDLDOMString>(lexicalGlobalObject, codecIdValue);
2629 RETURN_IF_EXCEPTION(throwScope, { });
2630 }
2631 JSValue kindValue;
2632 if (isNullOrUndefined)
2633 kindValue = jsUndefined();
2634 else {
2635 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
2636 RETURN_IF_EXCEPTION(throwScope, { });
2637 }
2638 if (!kindValue.isUndefined()) {
2639 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
2640 RETURN_IF_EXCEPTION(throwScope, { });
2641 } else {
2642 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCOutboundRtpStreamStats", "DOMString");
2643 return { };
2644 }
2645 JSValue mediaTypeValue;
2646 if (isNullOrUndefined)
2647 mediaTypeValue = jsUndefined();
2648 else {
2649 mediaTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaType"));
2650 RETURN_IF_EXCEPTION(throwScope, { });
2651 }
2652 if (!mediaTypeValue.isUndefined()) {
2653 result.mediaType = convert<IDLDOMString>(lexicalGlobalObject, mediaTypeValue);
2654 RETURN_IF_EXCEPTION(throwScope, { });
2655 } else {
2656 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "mediaType", "RTCOutboundRtpStreamStats", "DOMString");
2657 return { };
2658 }
2659 JSValue ssrcValue;
2660 if (isNullOrUndefined)
2661 ssrcValue = jsUndefined();
2662 else {
2663 ssrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ssrc"));
2664 RETURN_IF_EXCEPTION(throwScope, { });
2665 }
2666 if (!ssrcValue.isUndefined()) {
2667 result.ssrc = convert<IDLUnsignedLong>(lexicalGlobalObject, ssrcValue);
2668 RETURN_IF_EXCEPTION(throwScope, { });
2669 } else {
2670 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "ssrc", "RTCOutboundRtpStreamStats", "unsigned long");
2671 return { };
2672 }
2673 JSValue transportIdValue;
2674 if (isNullOrUndefined)
2675 transportIdValue = jsUndefined();
2676 else {
2677 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
2678 RETURN_IF_EXCEPTION(throwScope, { });
2679 }
2680 if (!transportIdValue.isUndefined()) {
2681 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
2682 RETURN_IF_EXCEPTION(throwScope, { });
2683 }
2684 JSValue bytesSentValue;
2685 if (isNullOrUndefined)
2686 bytesSentValue = jsUndefined();
2687 else {
2688 bytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesSent"));
2689 RETURN_IF_EXCEPTION(throwScope, { });
2690 }
2691 if (!bytesSentValue.isUndefined()) {
2692 result.bytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesSentValue);
2693 RETURN_IF_EXCEPTION(throwScope, { });
2694 }
2695 JSValue packetsSentValue;
2696 if (isNullOrUndefined)
2697 packetsSentValue = jsUndefined();
2698 else {
2699 packetsSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsSent"));
2700 RETURN_IF_EXCEPTION(throwScope, { });
2701 }
2702 if (!packetsSentValue.isUndefined()) {
2703 result.packetsSent = convert<IDLUnsignedLong>(lexicalGlobalObject, packetsSentValue);
2704 RETURN_IF_EXCEPTION(throwScope, { });
2705 }
2706 JSValue averageRtcpIntervalValue;
2707 if (isNullOrUndefined)
2708 averageRtcpIntervalValue = jsUndefined();
2709 else {
2710 averageRtcpIntervalValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "averageRtcpInterval"));
2711 RETURN_IF_EXCEPTION(throwScope, { });
2712 }
2713 if (!averageRtcpIntervalValue.isUndefined()) {
2714 result.averageRtcpInterval = convert<IDLDouble>(lexicalGlobalObject, averageRtcpIntervalValue);
2715 RETURN_IF_EXCEPTION(throwScope, { });
2716 }
2717 JSValue bytesDiscardedOnSendValue;
2718 if (isNullOrUndefined)
2719 bytesDiscardedOnSendValue = jsUndefined();
2720 else {
2721 bytesDiscardedOnSendValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesDiscardedOnSend"));
2722 RETURN_IF_EXCEPTION(throwScope, { });
2723 }
2724 if (!bytesDiscardedOnSendValue.isUndefined()) {
2725 result.bytesDiscardedOnSend = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesDiscardedOnSendValue);
2726 RETURN_IF_EXCEPTION(throwScope, { });
2727 }
2728 JSValue fecPacketsSentValue;
2729 if (isNullOrUndefined)
2730 fecPacketsSentValue = jsUndefined();
2731 else {
2732 fecPacketsSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fecPacketsSent"));
2733 RETURN_IF_EXCEPTION(throwScope, { });
2734 }
2735 if (!fecPacketsSentValue.isUndefined()) {
2736 result.fecPacketsSent = convert<IDLUnsignedLong>(lexicalGlobalObject, fecPacketsSentValue);
2737 RETURN_IF_EXCEPTION(throwScope, { });
2738 }
2739 JSValue firCountValue;
2740 if (isNullOrUndefined)
2741 firCountValue = jsUndefined();
2742 else {
2743 firCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "firCount"));
2744 RETURN_IF_EXCEPTION(throwScope, { });
2745 }
2746 if (!firCountValue.isUndefined()) {
2747 result.firCount = convert<IDLUnsignedLong>(lexicalGlobalObject, firCountValue);
2748 RETURN_IF_EXCEPTION(throwScope, { });
2749 }
2750 JSValue frameBitDepthValue;
2751 if (isNullOrUndefined)
2752 frameBitDepthValue = jsUndefined();
2753 else {
2754 frameBitDepthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameBitDepth"));
2755 RETURN_IF_EXCEPTION(throwScope, { });
2756 }
2757 if (!frameBitDepthValue.isUndefined()) {
2758 result.frameBitDepth = convert<IDLUnsignedLong>(lexicalGlobalObject, frameBitDepthValue);
2759 RETURN_IF_EXCEPTION(throwScope, { });
2760 }
2761 JSValue frameHeightValue;
2762 if (isNullOrUndefined)
2763 frameHeightValue = jsUndefined();
2764 else {
2765 frameHeightValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameHeight"));
2766 RETURN_IF_EXCEPTION(throwScope, { });
2767 }
2768 if (!frameHeightValue.isUndefined()) {
2769 result.frameHeight = convert<IDLUnsignedLong>(lexicalGlobalObject, frameHeightValue);
2770 RETURN_IF_EXCEPTION(throwScope, { });
2771 }
2772 JSValue frameWidthValue;
2773 if (isNullOrUndefined)
2774 frameWidthValue = jsUndefined();
2775 else {
2776 frameWidthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameWidth"));
2777 RETURN_IF_EXCEPTION(throwScope, { });
2778 }
2779 if (!frameWidthValue.isUndefined()) {
2780 result.frameWidth = convert<IDLUnsignedLong>(lexicalGlobalObject, frameWidthValue);
2781 RETURN_IF_EXCEPTION(throwScope, { });
2782 }
2783 JSValue framesDiscardedOnSendValue;
2784 if (isNullOrUndefined)
2785 framesDiscardedOnSendValue = jsUndefined();
2786 else {
2787 framesDiscardedOnSendValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDiscardedOnSend"));
2788 RETURN_IF_EXCEPTION(throwScope, { });
2789 }
2790 if (!framesDiscardedOnSendValue.isUndefined()) {
2791 result.framesDiscardedOnSend = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDiscardedOnSendValue);
2792 RETURN_IF_EXCEPTION(throwScope, { });
2793 }
2794 JSValue framesEncodedValue;
2795 if (isNullOrUndefined)
2796 framesEncodedValue = jsUndefined();
2797 else {
2798 framesEncodedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesEncoded"));
2799 RETURN_IF_EXCEPTION(throwScope, { });
2800 }
2801 if (!framesEncodedValue.isUndefined()) {
2802 result.framesEncoded = convert<IDLUnsignedLong>(lexicalGlobalObject, framesEncodedValue);
2803 RETURN_IF_EXCEPTION(throwScope, { });
2804 }
2805 JSValue framesPerSecondValue;
2806 if (isNullOrUndefined)
2807 framesPerSecondValue = jsUndefined();
2808 else {
2809 framesPerSecondValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesPerSecond"));
2810 RETURN_IF_EXCEPTION(throwScope, { });
2811 }
2812 if (!framesPerSecondValue.isUndefined()) {
2813 result.framesPerSecond = convert<IDLDouble>(lexicalGlobalObject, framesPerSecondValue);
2814 RETURN_IF_EXCEPTION(throwScope, { });
2815 }
2816 JSValue framesSentValue;
2817 if (isNullOrUndefined)
2818 framesSentValue = jsUndefined();
2819 else {
2820 framesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesSent"));
2821 RETURN_IF_EXCEPTION(throwScope, { });
2822 }
2823 if (!framesSentValue.isUndefined()) {
2824 result.framesSent = convert<IDLUnsignedLong>(lexicalGlobalObject, framesSentValue);
2825 RETURN_IF_EXCEPTION(throwScope, { });
2826 }
2827 JSValue headerBytesSentValue;
2828 if (isNullOrUndefined)
2829 headerBytesSentValue = jsUndefined();
2830 else {
2831 headerBytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "headerBytesSent"));
2832 RETURN_IF_EXCEPTION(throwScope, { });
2833 }
2834 if (!headerBytesSentValue.isUndefined()) {
2835 result.headerBytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, headerBytesSentValue);
2836 RETURN_IF_EXCEPTION(throwScope, { });
2837 }
2838 JSValue hugeFramesSentValue;
2839 if (isNullOrUndefined)
2840 hugeFramesSentValue = jsUndefined();
2841 else {
2842 hugeFramesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "hugeFramesSent"));
2843 RETURN_IF_EXCEPTION(throwScope, { });
2844 }
2845 if (!hugeFramesSentValue.isUndefined()) {
2846 result.hugeFramesSent = convert<IDLUnsignedLong>(lexicalGlobalObject, hugeFramesSentValue);
2847 RETURN_IF_EXCEPTION(throwScope, { });
2848 }
2849 JSValue keyFramesEncodedValue;
2850 if (isNullOrUndefined)
2851 keyFramesEncodedValue = jsUndefined();
2852 else {
2853 keyFramesEncodedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "keyFramesEncoded"));
2854 RETURN_IF_EXCEPTION(throwScope, { });
2855 }
2856 if (!keyFramesEncodedValue.isUndefined()) {
2857 result.keyFramesEncoded = convert<IDLUnsignedLong>(lexicalGlobalObject, keyFramesEncodedValue);
2858 RETURN_IF_EXCEPTION(throwScope, { });
2859 }
2860 JSValue lastPacketSentTimestampValue;
2861 if (isNullOrUndefined)
2862 lastPacketSentTimestampValue = jsUndefined();
2863 else {
2864 lastPacketSentTimestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "lastPacketSentTimestamp"));
2865 RETURN_IF_EXCEPTION(throwScope, { });
2866 }
2867 if (!lastPacketSentTimestampValue.isUndefined()) {
2868 result.lastPacketSentTimestamp = convert<IDLDouble>(lexicalGlobalObject, lastPacketSentTimestampValue);
2869 RETURN_IF_EXCEPTION(throwScope, { });
2870 }
2871 JSValue mediaSourceIdValue;
2872 if (isNullOrUndefined)
2873 mediaSourceIdValue = jsUndefined();
2874 else {
2875 mediaSourceIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mediaSourceId"));
2876 RETURN_IF_EXCEPTION(throwScope, { });
2877 }
2878 if (!mediaSourceIdValue.isUndefined()) {
2879 result.mediaSourceId = convert<IDLDOMString>(lexicalGlobalObject, mediaSourceIdValue);
2880 RETURN_IF_EXCEPTION(throwScope, { });
2881 }
2882 JSValue nackCountValue;
2883 if (isNullOrUndefined)
2884 nackCountValue = jsUndefined();
2885 else {
2886 nackCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "nackCount"));
2887 RETURN_IF_EXCEPTION(throwScope, { });
2888 }
2889 if (!nackCountValue.isUndefined()) {
2890 result.nackCount = convert<IDLUnsignedLong>(lexicalGlobalObject, nackCountValue);
2891 RETURN_IF_EXCEPTION(throwScope, { });
2892 }
2893 JSValue packetsDiscardedOnSendValue;
2894 if (isNullOrUndefined)
2895 packetsDiscardedOnSendValue = jsUndefined();
2896 else {
2897 packetsDiscardedOnSendValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "packetsDiscardedOnSend"));
2898 RETURN_IF_EXCEPTION(throwScope, { });
2899 }
2900 if (!packetsDiscardedOnSendValue.isUndefined()) {
2901 result.packetsDiscardedOnSend = convert<IDLUnsignedLong>(lexicalGlobalObject, packetsDiscardedOnSendValue);
2902 RETURN_IF_EXCEPTION(throwScope, { });
2903 }
2904 JSValue pliCountValue;
2905 if (isNullOrUndefined)
2906 pliCountValue = jsUndefined();
2907 else {
2908 pliCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "pliCount"));
2909 RETURN_IF_EXCEPTION(throwScope, { });
2910 }
2911 if (!pliCountValue.isUndefined()) {
2912 result.pliCount = convert<IDLUnsignedLong>(lexicalGlobalObject, pliCountValue);
2913 RETURN_IF_EXCEPTION(throwScope, { });
2914 }
2915 JSValue qpSumValue;
2916 if (isNullOrUndefined)
2917 qpSumValue = jsUndefined();
2918 else {
2919 qpSumValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "qpSum"));
2920 RETURN_IF_EXCEPTION(throwScope, { });
2921 }
2922 if (!qpSumValue.isUndefined()) {
2923 result.qpSum = convert<IDLUnsignedLongLong>(lexicalGlobalObject, qpSumValue);
2924 RETURN_IF_EXCEPTION(throwScope, { });
2925 }
2926 JSValue qualityLimitationResolutionChangesValue;
2927 if (isNullOrUndefined)
2928 qualityLimitationResolutionChangesValue = jsUndefined();
2929 else {
2930 qualityLimitationResolutionChangesValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "qualityLimitationResolutionChanges"));
2931 RETURN_IF_EXCEPTION(throwScope, { });
2932 }
2933 if (!qualityLimitationResolutionChangesValue.isUndefined()) {
2934 result.qualityLimitationResolutionChanges = convert<IDLUnsignedLong>(lexicalGlobalObject, qualityLimitationResolutionChangesValue);
2935 RETURN_IF_EXCEPTION(throwScope, { });
2936 }
2937 JSValue remoteIdValue;
2938 if (isNullOrUndefined)
2939 remoteIdValue = jsUndefined();
2940 else {
2941 remoteIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "remoteId"));
2942 RETURN_IF_EXCEPTION(throwScope, { });
2943 }
2944 if (!remoteIdValue.isUndefined()) {
2945 result.remoteId = convert<IDLDOMString>(lexicalGlobalObject, remoteIdValue);
2946 RETURN_IF_EXCEPTION(throwScope, { });
2947 }
2948 JSValue retransmittedBytesSentValue;
2949 if (isNullOrUndefined)
2950 retransmittedBytesSentValue = jsUndefined();
2951 else {
2952 retransmittedBytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "retransmittedBytesSent"));
2953 RETURN_IF_EXCEPTION(throwScope, { });
2954 }
2955 if (!retransmittedBytesSentValue.isUndefined()) {
2956 result.retransmittedBytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, retransmittedBytesSentValue);
2957 RETURN_IF_EXCEPTION(throwScope, { });
2958 }
2959 JSValue retransmittedPacketsSentValue;
2960 if (isNullOrUndefined)
2961 retransmittedPacketsSentValue = jsUndefined();
2962 else {
2963 retransmittedPacketsSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "retransmittedPacketsSent"));
2964 RETURN_IF_EXCEPTION(throwScope, { });
2965 }
2966 if (!retransmittedPacketsSentValue.isUndefined()) {
2967 result.retransmittedPacketsSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, retransmittedPacketsSentValue);
2968 RETURN_IF_EXCEPTION(throwScope, { });
2969 }
2970 JSValue ridValue;
2971 if (isNullOrUndefined)
2972 ridValue = jsUndefined();
2973 else {
2974 ridValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "rid"));
2975 RETURN_IF_EXCEPTION(throwScope, { });
2976 }
2977 if (!ridValue.isUndefined()) {
2978 result.rid = convert<IDLDOMString>(lexicalGlobalObject, ridValue);
2979 RETURN_IF_EXCEPTION(throwScope, { });
2980 }
2981 JSValue rtxSsrcValue;
2982 if (isNullOrUndefined)
2983 rtxSsrcValue = jsUndefined();
2984 else {
2985 rtxSsrcValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "rtxSsrc"));
2986 RETURN_IF_EXCEPTION(throwScope, { });
2987 }
2988 if (!rtxSsrcValue.isUndefined()) {
2989 result.rtxSsrc = convert<IDLUnsignedLong>(lexicalGlobalObject, rtxSsrcValue);
2990 RETURN_IF_EXCEPTION(throwScope, { });
2991 }
2992 JSValue samplesEncodedWithCeltValue;
2993 if (isNullOrUndefined)
2994 samplesEncodedWithCeltValue = jsUndefined();
2995 else {
2996 samplesEncodedWithCeltValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "samplesEncodedWithCelt"));
2997 RETURN_IF_EXCEPTION(throwScope, { });
2998 }
2999 if (!samplesEncodedWithCeltValue.isUndefined()) {
3000 result.samplesEncodedWithCelt = convert<IDLUnsignedLongLong>(lexicalGlobalObject, samplesEncodedWithCeltValue);
3001 RETURN_IF_EXCEPTION(throwScope, { });
3002 }
3003 JSValue samplesEncodedWithSilkValue;
3004 if (isNullOrUndefined)
3005 samplesEncodedWithSilkValue = jsUndefined();
3006 else {
3007 samplesEncodedWithSilkValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "samplesEncodedWithSilk"));
3008 RETURN_IF_EXCEPTION(throwScope, { });
3009 }
3010 if (!samplesEncodedWithSilkValue.isUndefined()) {
3011 result.samplesEncodedWithSilk = convert<IDLUnsignedLongLong>(lexicalGlobalObject, samplesEncodedWithSilkValue);
3012 RETURN_IF_EXCEPTION(throwScope, { });
3013 }
3014 JSValue senderIdValue;
3015 if (isNullOrUndefined)
3016 senderIdValue = jsUndefined();
3017 else {
3018 senderIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "senderId"));
3019 RETURN_IF_EXCEPTION(throwScope, { });
3020 }
3021 if (!senderIdValue.isUndefined()) {
3022 result.senderId = convert<IDLDOMString>(lexicalGlobalObject, senderIdValue);
3023 RETURN_IF_EXCEPTION(throwScope, { });
3024 }
3025 JSValue sliCountValue;
3026 if (isNullOrUndefined)
3027 sliCountValue = jsUndefined();
3028 else {
3029 sliCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "sliCount"));
3030 RETURN_IF_EXCEPTION(throwScope, { });
3031 }
3032 if (!sliCountValue.isUndefined()) {
3033 result.sliCount = convert<IDLUnsignedLong>(lexicalGlobalObject, sliCountValue);
3034 RETURN_IF_EXCEPTION(throwScope, { });
3035 }
3036 JSValue targetBitrateValue;
3037 if (isNullOrUndefined)
3038 targetBitrateValue = jsUndefined();
3039 else {
3040 targetBitrateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "targetBitrate"));
3041 RETURN_IF_EXCEPTION(throwScope, { });
3042 }
3043 if (!targetBitrateValue.isUndefined()) {
3044 result.targetBitrate = convert<IDLDouble>(lexicalGlobalObject, targetBitrateValue);
3045 RETURN_IF_EXCEPTION(throwScope, { });
3046 }
3047 JSValue totalEncodeTimeValue;
3048 if (isNullOrUndefined)
3049 totalEncodeTimeValue = jsUndefined();
3050 else {
3051 totalEncodeTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalEncodeTime"));
3052 RETURN_IF_EXCEPTION(throwScope, { });
3053 }
3054 if (!totalEncodeTimeValue.isUndefined()) {
3055 result.totalEncodeTime = convert<IDLDouble>(lexicalGlobalObject, totalEncodeTimeValue);
3056 RETURN_IF_EXCEPTION(throwScope, { });
3057 }
3058 JSValue totalEncodedBytesTargetValue;
3059 if (isNullOrUndefined)
3060 totalEncodedBytesTargetValue = jsUndefined();
3061 else {
3062 totalEncodedBytesTargetValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalEncodedBytesTarget"));
3063 RETURN_IF_EXCEPTION(throwScope, { });
3064 }
3065 if (!totalEncodedBytesTargetValue.isUndefined()) {
3066 result.totalEncodedBytesTarget = convert<IDLUnsignedLongLong>(lexicalGlobalObject, totalEncodedBytesTargetValue);
3067 RETURN_IF_EXCEPTION(throwScope, { });
3068 }
3069 JSValue totalPacketSendDelayValue;
3070 if (isNullOrUndefined)
3071 totalPacketSendDelayValue = jsUndefined();
3072 else {
3073 totalPacketSendDelayValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalPacketSendDelay"));
3074 RETURN_IF_EXCEPTION(throwScope, { });
3075 }
3076 if (!totalPacketSendDelayValue.isUndefined()) {
3077 result.totalPacketSendDelay = convert<IDLDouble>(lexicalGlobalObject, totalPacketSendDelayValue);
3078 RETURN_IF_EXCEPTION(throwScope, { });
3079 }
3080 JSValue totalSamplesSentValue;
3081 if (isNullOrUndefined)
3082 totalSamplesSentValue = jsUndefined();
3083 else {
3084 totalSamplesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalSamplesSent"));
3085 RETURN_IF_EXCEPTION(throwScope, { });
3086 }
3087 if (!totalSamplesSentValue.isUndefined()) {
3088 result.totalSamplesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, totalSamplesSentValue);
3089 RETURN_IF_EXCEPTION(throwScope, { });
3090 }
3091 JSValue trackIdValue;
3092 if (isNullOrUndefined)
3093 trackIdValue = jsUndefined();
3094 else {
3095 trackIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackId"));
3096 RETURN_IF_EXCEPTION(throwScope, { });
3097 }
3098 if (!trackIdValue.isUndefined()) {
3099 result.trackId = convert<IDLDOMString>(lexicalGlobalObject, trackIdValue);
3100 RETURN_IF_EXCEPTION(throwScope, { });
3101 }
3102 JSValue voiceActivityFlagValue;
3103 if (isNullOrUndefined)
3104 voiceActivityFlagValue = jsUndefined();
3105 else {
3106 voiceActivityFlagValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "voiceActivityFlag"));
3107 RETURN_IF_EXCEPTION(throwScope, { });
3108 }
3109 if (!voiceActivityFlagValue.isUndefined()) {
3110 result.voiceActivityFlag = convert<IDLBoolean>(lexicalGlobalObject, voiceActivityFlagValue);
3111 RETURN_IF_EXCEPTION(throwScope, { });
3112 }
3113 return result;
3114}
3115
3116JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::OutboundRtpStreamStats& dictionary)
3117{
3118 auto& vm = JSC::getVM(&lexicalGlobalObject);
3119 auto throwScope = DECLARE_THROW_SCOPE(vm);
3120
3121 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
3122
3123 if (!IDLDOMString::isNullValue(dictionary.id)) {
3124 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
3125 RETURN_IF_EXCEPTION(throwScope, { });
3126 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
3127 }
3128 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
3129 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
3130 RETURN_IF_EXCEPTION(throwScope, { });
3131 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
3132 }
3133 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
3134 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
3135 RETURN_IF_EXCEPTION(throwScope, { });
3136 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
3137 }
3138 if (!IDLDOMString::isNullValue(dictionary.codecId)) {
3139 auto codecIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.codecId));
3140 RETURN_IF_EXCEPTION(throwScope, { });
3141 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecId"), codecIdValue);
3142 }
3143 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
3144 RETURN_IF_EXCEPTION(throwScope, { });
3145 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
3146 auto mediaTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.mediaType);
3147 RETURN_IF_EXCEPTION(throwScope, { });
3148 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaType"), mediaTypeValue);
3149 auto ssrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, dictionary.ssrc);
3150 RETURN_IF_EXCEPTION(throwScope, { });
3151 result->putDirect(vm, JSC::Identifier::fromString(vm, "ssrc"), ssrcValue);
3152 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
3153 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
3154 RETURN_IF_EXCEPTION(throwScope, { });
3155 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
3156 }
3157 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesSent)) {
3158 auto bytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesSent));
3159 RETURN_IF_EXCEPTION(throwScope, { });
3160 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesSent"), bytesSentValue);
3161 }
3162 if (!IDLUnsignedLong::isNullValue(dictionary.packetsSent)) {
3163 auto packetsSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.packetsSent));
3164 RETURN_IF_EXCEPTION(throwScope, { });
3165 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsSent"), packetsSentValue);
3166 }
3167 if (!IDLDouble::isNullValue(dictionary.averageRtcpInterval)) {
3168 auto averageRtcpIntervalValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.averageRtcpInterval));
3169 RETURN_IF_EXCEPTION(throwScope, { });
3170 result->putDirect(vm, JSC::Identifier::fromString(vm, "averageRtcpInterval"), averageRtcpIntervalValue);
3171 }
3172 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesDiscardedOnSend)) {
3173 auto bytesDiscardedOnSendValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesDiscardedOnSend));
3174 RETURN_IF_EXCEPTION(throwScope, { });
3175 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesDiscardedOnSend"), bytesDiscardedOnSendValue);
3176 }
3177 if (!IDLUnsignedLong::isNullValue(dictionary.fecPacketsSent)) {
3178 auto fecPacketsSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.fecPacketsSent));
3179 RETURN_IF_EXCEPTION(throwScope, { });
3180 result->putDirect(vm, JSC::Identifier::fromString(vm, "fecPacketsSent"), fecPacketsSentValue);
3181 }
3182 if (!IDLUnsignedLong::isNullValue(dictionary.firCount)) {
3183 auto firCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.firCount));
3184 RETURN_IF_EXCEPTION(throwScope, { });
3185 result->putDirect(vm, JSC::Identifier::fromString(vm, "firCount"), firCountValue);
3186 }
3187 if (!IDLUnsignedLong::isNullValue(dictionary.frameBitDepth)) {
3188 auto frameBitDepthValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameBitDepth));
3189 RETURN_IF_EXCEPTION(throwScope, { });
3190 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameBitDepth"), frameBitDepthValue);
3191 }
3192 if (!IDLUnsignedLong::isNullValue(dictionary.frameHeight)) {
3193 auto frameHeightValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameHeight));
3194 RETURN_IF_EXCEPTION(throwScope, { });
3195 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameHeight"), frameHeightValue);
3196 }
3197 if (!IDLUnsignedLong::isNullValue(dictionary.frameWidth)) {
3198 auto frameWidthValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameWidth));
3199 RETURN_IF_EXCEPTION(throwScope, { });
3200 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameWidth"), frameWidthValue);
3201 }
3202 if (!IDLUnsignedLong::isNullValue(dictionary.framesDiscardedOnSend)) {
3203 auto framesDiscardedOnSendValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDiscardedOnSend));
3204 RETURN_IF_EXCEPTION(throwScope, { });
3205 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDiscardedOnSend"), framesDiscardedOnSendValue);
3206 }
3207 if (!IDLUnsignedLong::isNullValue(dictionary.framesEncoded)) {
3208 auto framesEncodedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesEncoded));
3209 RETURN_IF_EXCEPTION(throwScope, { });
3210 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesEncoded"), framesEncodedValue);
3211 }
3212 if (!IDLDouble::isNullValue(dictionary.framesPerSecond)) {
3213 auto framesPerSecondValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.framesPerSecond));
3214 RETURN_IF_EXCEPTION(throwScope, { });
3215 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesPerSecond"), framesPerSecondValue);
3216 }
3217 if (!IDLUnsignedLong::isNullValue(dictionary.framesSent)) {
3218 auto framesSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesSent));
3219 RETURN_IF_EXCEPTION(throwScope, { });
3220 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesSent"), framesSentValue);
3221 }
3222 if (!IDLUnsignedLongLong::isNullValue(dictionary.headerBytesSent)) {
3223 auto headerBytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.headerBytesSent));
3224 RETURN_IF_EXCEPTION(throwScope, { });
3225 result->putDirect(vm, JSC::Identifier::fromString(vm, "headerBytesSent"), headerBytesSentValue);
3226 }
3227 if (!IDLUnsignedLong::isNullValue(dictionary.hugeFramesSent)) {
3228 auto hugeFramesSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.hugeFramesSent));
3229 RETURN_IF_EXCEPTION(throwScope, { });
3230 result->putDirect(vm, JSC::Identifier::fromString(vm, "hugeFramesSent"), hugeFramesSentValue);
3231 }
3232 if (!IDLUnsignedLong::isNullValue(dictionary.keyFramesEncoded)) {
3233 auto keyFramesEncodedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.keyFramesEncoded));
3234 RETURN_IF_EXCEPTION(throwScope, { });
3235 result->putDirect(vm, JSC::Identifier::fromString(vm, "keyFramesEncoded"), keyFramesEncodedValue);
3236 }
3237 if (!IDLDouble::isNullValue(dictionary.lastPacketSentTimestamp)) {
3238 auto lastPacketSentTimestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.lastPacketSentTimestamp));
3239 RETURN_IF_EXCEPTION(throwScope, { });
3240 result->putDirect(vm, JSC::Identifier::fromString(vm, "lastPacketSentTimestamp"), lastPacketSentTimestampValue);
3241 }
3242 if (!IDLDOMString::isNullValue(dictionary.mediaSourceId)) {
3243 auto mediaSourceIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.mediaSourceId));
3244 RETURN_IF_EXCEPTION(throwScope, { });
3245 result->putDirect(vm, JSC::Identifier::fromString(vm, "mediaSourceId"), mediaSourceIdValue);
3246 }
3247 if (!IDLUnsignedLong::isNullValue(dictionary.nackCount)) {
3248 auto nackCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.nackCount));
3249 RETURN_IF_EXCEPTION(throwScope, { });
3250 result->putDirect(vm, JSC::Identifier::fromString(vm, "nackCount"), nackCountValue);
3251 }
3252 if (!IDLUnsignedLong::isNullValue(dictionary.packetsDiscardedOnSend)) {
3253 auto packetsDiscardedOnSendValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.packetsDiscardedOnSend));
3254 RETURN_IF_EXCEPTION(throwScope, { });
3255 result->putDirect(vm, JSC::Identifier::fromString(vm, "packetsDiscardedOnSend"), packetsDiscardedOnSendValue);
3256 }
3257 if (!IDLUnsignedLong::isNullValue(dictionary.pliCount)) {
3258 auto pliCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.pliCount));
3259 RETURN_IF_EXCEPTION(throwScope, { });
3260 result->putDirect(vm, JSC::Identifier::fromString(vm, "pliCount"), pliCountValue);
3261 }
3262 if (!IDLUnsignedLongLong::isNullValue(dictionary.qpSum)) {
3263 auto qpSumValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.qpSum));
3264 RETURN_IF_EXCEPTION(throwScope, { });
3265 result->putDirect(vm, JSC::Identifier::fromString(vm, "qpSum"), qpSumValue);
3266 }
3267 if (!IDLUnsignedLong::isNullValue(dictionary.qualityLimitationResolutionChanges)) {
3268 auto qualityLimitationResolutionChangesValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.qualityLimitationResolutionChanges));
3269 RETURN_IF_EXCEPTION(throwScope, { });
3270 result->putDirect(vm, JSC::Identifier::fromString(vm, "qualityLimitationResolutionChanges"), qualityLimitationResolutionChangesValue);
3271 }
3272 if (!IDLDOMString::isNullValue(dictionary.remoteId)) {
3273 auto remoteIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.remoteId));
3274 RETURN_IF_EXCEPTION(throwScope, { });
3275 result->putDirect(vm, JSC::Identifier::fromString(vm, "remoteId"), remoteIdValue);
3276 }
3277 if (!IDLUnsignedLongLong::isNullValue(dictionary.retransmittedBytesSent)) {
3278 auto retransmittedBytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.retransmittedBytesSent));
3279 RETURN_IF_EXCEPTION(throwScope, { });
3280 result->putDirect(vm, JSC::Identifier::fromString(vm, "retransmittedBytesSent"), retransmittedBytesSentValue);
3281 }
3282 if (!IDLUnsignedLongLong::isNullValue(dictionary.retransmittedPacketsSent)) {
3283 auto retransmittedPacketsSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.retransmittedPacketsSent));
3284 RETURN_IF_EXCEPTION(throwScope, { });
3285 result->putDirect(vm, JSC::Identifier::fromString(vm, "retransmittedPacketsSent"), retransmittedPacketsSentValue);
3286 }
3287 if (!IDLDOMString::isNullValue(dictionary.rid)) {
3288 auto ridValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.rid));
3289 RETURN_IF_EXCEPTION(throwScope, { });
3290 result->putDirect(vm, JSC::Identifier::fromString(vm, "rid"), ridValue);
3291 }
3292 if (!IDLUnsignedLong::isNullValue(dictionary.rtxSsrc)) {
3293 auto rtxSsrcValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.rtxSsrc));
3294 RETURN_IF_EXCEPTION(throwScope, { });
3295 result->putDirect(vm, JSC::Identifier::fromString(vm, "rtxSsrc"), rtxSsrcValue);
3296 }
3297 if (!IDLUnsignedLongLong::isNullValue(dictionary.samplesEncodedWithCelt)) {
3298 auto samplesEncodedWithCeltValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.samplesEncodedWithCelt));
3299 RETURN_IF_EXCEPTION(throwScope, { });
3300 result->putDirect(vm, JSC::Identifier::fromString(vm, "samplesEncodedWithCelt"), samplesEncodedWithCeltValue);
3301 }
3302 if (!IDLUnsignedLongLong::isNullValue(dictionary.samplesEncodedWithSilk)) {
3303 auto samplesEncodedWithSilkValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.samplesEncodedWithSilk));
3304 RETURN_IF_EXCEPTION(throwScope, { });
3305 result->putDirect(vm, JSC::Identifier::fromString(vm, "samplesEncodedWithSilk"), samplesEncodedWithSilkValue);
3306 }
3307 if (!IDLDOMString::isNullValue(dictionary.senderId)) {
3308 auto senderIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.senderId));
3309 RETURN_IF_EXCEPTION(throwScope, { });
3310 result->putDirect(vm, JSC::Identifier::fromString(vm, "senderId"), senderIdValue);
3311 }
3312 if (!IDLUnsignedLong::isNullValue(dictionary.sliCount)) {
3313 auto sliCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.sliCount));
3314 RETURN_IF_EXCEPTION(throwScope, { });
3315 result->putDirect(vm, JSC::Identifier::fromString(vm, "sliCount"), sliCountValue);
3316 }
3317 if (!IDLDouble::isNullValue(dictionary.targetBitrate)) {
3318 auto targetBitrateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.targetBitrate));
3319 RETURN_IF_EXCEPTION(throwScope, { });
3320 result->putDirect(vm, JSC::Identifier::fromString(vm, "targetBitrate"), targetBitrateValue);
3321 }
3322 if (!IDLDouble::isNullValue(dictionary.totalEncodeTime)) {
3323 auto totalEncodeTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalEncodeTime));
3324 RETURN_IF_EXCEPTION(throwScope, { });
3325 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalEncodeTime"), totalEncodeTimeValue);
3326 }
3327 if (!IDLUnsignedLongLong::isNullValue(dictionary.totalEncodedBytesTarget)) {
3328 auto totalEncodedBytesTargetValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.totalEncodedBytesTarget));
3329 RETURN_IF_EXCEPTION(throwScope, { });
3330 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalEncodedBytesTarget"), totalEncodedBytesTargetValue);
3331 }
3332 if (!IDLDouble::isNullValue(dictionary.totalPacketSendDelay)) {
3333 auto totalPacketSendDelayValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalPacketSendDelay));
3334 RETURN_IF_EXCEPTION(throwScope, { });
3335 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalPacketSendDelay"), totalPacketSendDelayValue);
3336 }
3337 if (!IDLUnsignedLongLong::isNullValue(dictionary.totalSamplesSent)) {
3338 auto totalSamplesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.totalSamplesSent));
3339 RETURN_IF_EXCEPTION(throwScope, { });
3340 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalSamplesSent"), totalSamplesSentValue);
3341 }
3342 if (!IDLDOMString::isNullValue(dictionary.trackId)) {
3343 auto trackIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.trackId));
3344 RETURN_IF_EXCEPTION(throwScope, { });
3345 result->putDirect(vm, JSC::Identifier::fromString(vm, "trackId"), trackIdValue);
3346 }
3347 if (!IDLBoolean::isNullValue(dictionary.voiceActivityFlag)) {
3348 auto voiceActivityFlagValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.voiceActivityFlag));
3349 RETURN_IF_EXCEPTION(throwScope, { });
3350 result->putDirect(vm, JSC::Identifier::fromString(vm, "voiceActivityFlag"), voiceActivityFlagValue);
3351 }
3352 return result;
3353}
3354
3355template<> RTCStatsReport::MediaStreamTrackStats convertDictionary<RTCStatsReport::MediaStreamTrackStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
3356{
3357 VM& vm = JSC::getVM(&lexicalGlobalObject);
3358 auto throwScope = DECLARE_THROW_SCOPE(vm);
3359 bool isNullOrUndefined = value.isUndefinedOrNull();
3360 auto* object = isNullOrUndefined ? nullptr : value.getObject();
3361 if (UNLIKELY(!isNullOrUndefined && !object)) {
3362 throwTypeError(&lexicalGlobalObject, throwScope);
3363 return { };
3364 }
3365 RTCStatsReport::MediaStreamTrackStats result;
3366 JSValue idValue;
3367 if (isNullOrUndefined)
3368 idValue = jsUndefined();
3369 else {
3370 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
3371 RETURN_IF_EXCEPTION(throwScope, { });
3372 }
3373 if (!idValue.isUndefined()) {
3374 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
3375 RETURN_IF_EXCEPTION(throwScope, { });
3376 }
3377 JSValue timestampValue;
3378 if (isNullOrUndefined)
3379 timestampValue = jsUndefined();
3380 else {
3381 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
3382 RETURN_IF_EXCEPTION(throwScope, { });
3383 }
3384 if (!timestampValue.isUndefined()) {
3385 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
3386 RETURN_IF_EXCEPTION(throwScope, { });
3387 }
3388 JSValue typeValue;
3389 if (isNullOrUndefined)
3390 typeValue = jsUndefined();
3391 else {
3392 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
3393 RETURN_IF_EXCEPTION(throwScope, { });
3394 }
3395 if (!typeValue.isUndefined()) {
3396 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
3397 RETURN_IF_EXCEPTION(throwScope, { });
3398 }
3399 JSValue audioLevelValue;
3400 if (isNullOrUndefined)
3401 audioLevelValue = jsUndefined();
3402 else {
3403 audioLevelValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "audioLevel"));
3404 RETURN_IF_EXCEPTION(throwScope, { });
3405 }
3406 if (!audioLevelValue.isUndefined()) {
3407 result.audioLevel = convert<IDLDouble>(lexicalGlobalObject, audioLevelValue);
3408 RETURN_IF_EXCEPTION(throwScope, { });
3409 }
3410 JSValue detachedValue;
3411 if (isNullOrUndefined)
3412 detachedValue = jsUndefined();
3413 else {
3414 detachedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "detached"));
3415 RETURN_IF_EXCEPTION(throwScope, { });
3416 }
3417 if (!detachedValue.isUndefined()) {
3418 result.detached = convert<IDLBoolean>(lexicalGlobalObject, detachedValue);
3419 RETURN_IF_EXCEPTION(throwScope, { });
3420 }
3421 JSValue echoReturnLossValue;
3422 if (isNullOrUndefined)
3423 echoReturnLossValue = jsUndefined();
3424 else {
3425 echoReturnLossValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "echoReturnLoss"));
3426 RETURN_IF_EXCEPTION(throwScope, { });
3427 }
3428 if (!echoReturnLossValue.isUndefined()) {
3429 result.echoReturnLoss = convert<IDLDouble>(lexicalGlobalObject, echoReturnLossValue);
3430 RETURN_IF_EXCEPTION(throwScope, { });
3431 }
3432 JSValue echoReturnLossEnhancementValue;
3433 if (isNullOrUndefined)
3434 echoReturnLossEnhancementValue = jsUndefined();
3435 else {
3436 echoReturnLossEnhancementValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "echoReturnLossEnhancement"));
3437 RETURN_IF_EXCEPTION(throwScope, { });
3438 }
3439 if (!echoReturnLossEnhancementValue.isUndefined()) {
3440 result.echoReturnLossEnhancement = convert<IDLDouble>(lexicalGlobalObject, echoReturnLossEnhancementValue);
3441 RETURN_IF_EXCEPTION(throwScope, { });
3442 }
3443 JSValue endedValue;
3444 if (isNullOrUndefined)
3445 endedValue = jsUndefined();
3446 else {
3447 endedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "ended"));
3448 RETURN_IF_EXCEPTION(throwScope, { });
3449 }
3450 if (!endedValue.isUndefined()) {
3451 result.ended = convert<IDLBoolean>(lexicalGlobalObject, endedValue);
3452 RETURN_IF_EXCEPTION(throwScope, { });
3453 }
3454 JSValue frameHeightValue;
3455 if (isNullOrUndefined)
3456 frameHeightValue = jsUndefined();
3457 else {
3458 frameHeightValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameHeight"));
3459 RETURN_IF_EXCEPTION(throwScope, { });
3460 }
3461 if (!frameHeightValue.isUndefined()) {
3462 result.frameHeight = convert<IDLUnsignedLong>(lexicalGlobalObject, frameHeightValue);
3463 RETURN_IF_EXCEPTION(throwScope, { });
3464 }
3465 JSValue frameWidthValue;
3466 if (isNullOrUndefined)
3467 frameWidthValue = jsUndefined();
3468 else {
3469 frameWidthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frameWidth"));
3470 RETURN_IF_EXCEPTION(throwScope, { });
3471 }
3472 if (!frameWidthValue.isUndefined()) {
3473 result.frameWidth = convert<IDLUnsignedLong>(lexicalGlobalObject, frameWidthValue);
3474 RETURN_IF_EXCEPTION(throwScope, { });
3475 }
3476 JSValue framesCorruptedValue;
3477 if (isNullOrUndefined)
3478 framesCorruptedValue = jsUndefined();
3479 else {
3480 framesCorruptedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesCorrupted"));
3481 RETURN_IF_EXCEPTION(throwScope, { });
3482 }
3483 if (!framesCorruptedValue.isUndefined()) {
3484 result.framesCorrupted = convert<IDLUnsignedLong>(lexicalGlobalObject, framesCorruptedValue);
3485 RETURN_IF_EXCEPTION(throwScope, { });
3486 }
3487 JSValue framesDecodedValue;
3488 if (isNullOrUndefined)
3489 framesDecodedValue = jsUndefined();
3490 else {
3491 framesDecodedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDecoded"));
3492 RETURN_IF_EXCEPTION(throwScope, { });
3493 }
3494 if (!framesDecodedValue.isUndefined()) {
3495 result.framesDecoded = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDecodedValue);
3496 RETURN_IF_EXCEPTION(throwScope, { });
3497 }
3498 JSValue framesDroppedValue;
3499 if (isNullOrUndefined)
3500 framesDroppedValue = jsUndefined();
3501 else {
3502 framesDroppedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesDropped"));
3503 RETURN_IF_EXCEPTION(throwScope, { });
3504 }
3505 if (!framesDroppedValue.isUndefined()) {
3506 result.framesDropped = convert<IDLUnsignedLong>(lexicalGlobalObject, framesDroppedValue);
3507 RETURN_IF_EXCEPTION(throwScope, { });
3508 }
3509 JSValue framesPerSecondValue;
3510 if (isNullOrUndefined)
3511 framesPerSecondValue = jsUndefined();
3512 else {
3513 framesPerSecondValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesPerSecond"));
3514 RETURN_IF_EXCEPTION(throwScope, { });
3515 }
3516 if (!framesPerSecondValue.isUndefined()) {
3517 result.framesPerSecond = convert<IDLDouble>(lexicalGlobalObject, framesPerSecondValue);
3518 RETURN_IF_EXCEPTION(throwScope, { });
3519 }
3520 JSValue framesReceivedValue;
3521 if (isNullOrUndefined)
3522 framesReceivedValue = jsUndefined();
3523 else {
3524 framesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesReceived"));
3525 RETURN_IF_EXCEPTION(throwScope, { });
3526 }
3527 if (!framesReceivedValue.isUndefined()) {
3528 result.framesReceived = convert<IDLUnsignedLong>(lexicalGlobalObject, framesReceivedValue);
3529 RETURN_IF_EXCEPTION(throwScope, { });
3530 }
3531 JSValue framesSentValue;
3532 if (isNullOrUndefined)
3533 framesSentValue = jsUndefined();
3534 else {
3535 framesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesSent"));
3536 RETURN_IF_EXCEPTION(throwScope, { });
3537 }
3538 if (!framesSentValue.isUndefined()) {
3539 result.framesSent = convert<IDLUnsignedLong>(lexicalGlobalObject, framesSentValue);
3540 RETURN_IF_EXCEPTION(throwScope, { });
3541 }
3542 JSValue freezeCountValue;
3543 if (isNullOrUndefined)
3544 freezeCountValue = jsUndefined();
3545 else {
3546 freezeCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "freezeCount"));
3547 RETURN_IF_EXCEPTION(throwScope, { });
3548 }
3549 if (!freezeCountValue.isUndefined()) {
3550 result.freezeCount = convert<IDLUnsignedLong>(lexicalGlobalObject, freezeCountValue);
3551 RETURN_IF_EXCEPTION(throwScope, { });
3552 }
3553 JSValue fullFramesLostValue;
3554 if (isNullOrUndefined)
3555 fullFramesLostValue = jsUndefined();
3556 else {
3557 fullFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fullFramesLost"));
3558 RETURN_IF_EXCEPTION(throwScope, { });
3559 }
3560 if (!fullFramesLostValue.isUndefined()) {
3561 result.fullFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, fullFramesLostValue);
3562 RETURN_IF_EXCEPTION(throwScope, { });
3563 }
3564 JSValue jitterBufferFlushesValue;
3565 if (isNullOrUndefined)
3566 jitterBufferFlushesValue = jsUndefined();
3567 else {
3568 jitterBufferFlushesValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "jitterBufferFlushes"));
3569 RETURN_IF_EXCEPTION(throwScope, { });
3570 }
3571 if (!jitterBufferFlushesValue.isUndefined()) {
3572 result.jitterBufferFlushes = convert<IDLUnsignedLongLong>(lexicalGlobalObject, jitterBufferFlushesValue);
3573 RETURN_IF_EXCEPTION(throwScope, { });
3574 }
3575 JSValue partialFramesLostValue;
3576 if (isNullOrUndefined)
3577 partialFramesLostValue = jsUndefined();
3578 else {
3579 partialFramesLostValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialFramesLost"));
3580 RETURN_IF_EXCEPTION(throwScope, { });
3581 }
3582 if (!partialFramesLostValue.isUndefined()) {
3583 result.partialFramesLost = convert<IDLUnsignedLong>(lexicalGlobalObject, partialFramesLostValue);
3584 RETURN_IF_EXCEPTION(throwScope, { });
3585 }
3586 JSValue pauseCountValue;
3587 if (isNullOrUndefined)
3588 pauseCountValue = jsUndefined();
3589 else {
3590 pauseCountValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "pauseCount"));
3591 RETURN_IF_EXCEPTION(throwScope, { });
3592 }
3593 if (!pauseCountValue.isUndefined()) {
3594 result.pauseCount = convert<IDLUnsignedLong>(lexicalGlobalObject, pauseCountValue);
3595 RETURN_IF_EXCEPTION(throwScope, { });
3596 }
3597 JSValue remoteSourceValue;
3598 if (isNullOrUndefined)
3599 remoteSourceValue = jsUndefined();
3600 else {
3601 remoteSourceValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "remoteSource"));
3602 RETURN_IF_EXCEPTION(throwScope, { });
3603 }
3604 if (!remoteSourceValue.isUndefined()) {
3605 result.remoteSource = convert<IDLBoolean>(lexicalGlobalObject, remoteSourceValue);
3606 RETURN_IF_EXCEPTION(throwScope, { });
3607 }
3608 JSValue sumOfSquaredFramesDurationValue;
3609 if (isNullOrUndefined)
3610 sumOfSquaredFramesDurationValue = jsUndefined();
3611 else {
3612 sumOfSquaredFramesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "sumOfSquaredFramesDuration"));
3613 RETURN_IF_EXCEPTION(throwScope, { });
3614 }
3615 if (!sumOfSquaredFramesDurationValue.isUndefined()) {
3616 result.sumOfSquaredFramesDuration = convert<IDLDouble>(lexicalGlobalObject, sumOfSquaredFramesDurationValue);
3617 RETURN_IF_EXCEPTION(throwScope, { });
3618 }
3619 JSValue totalFramesDurationValue;
3620 if (isNullOrUndefined)
3621 totalFramesDurationValue = jsUndefined();
3622 else {
3623 totalFramesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalFramesDuration"));
3624 RETURN_IF_EXCEPTION(throwScope, { });
3625 }
3626 if (!totalFramesDurationValue.isUndefined()) {
3627 result.totalFramesDuration = convert<IDLDouble>(lexicalGlobalObject, totalFramesDurationValue);
3628 RETURN_IF_EXCEPTION(throwScope, { });
3629 }
3630 JSValue totalFreezesDurationValue;
3631 if (isNullOrUndefined)
3632 totalFreezesDurationValue = jsUndefined();
3633 else {
3634 totalFreezesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalFreezesDuration"));
3635 RETURN_IF_EXCEPTION(throwScope, { });
3636 }
3637 if (!totalFreezesDurationValue.isUndefined()) {
3638 result.totalFreezesDuration = convert<IDLDouble>(lexicalGlobalObject, totalFreezesDurationValue);
3639 RETURN_IF_EXCEPTION(throwScope, { });
3640 }
3641 JSValue totalPausesDurationValue;
3642 if (isNullOrUndefined)
3643 totalPausesDurationValue = jsUndefined();
3644 else {
3645 totalPausesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalPausesDuration"));
3646 RETURN_IF_EXCEPTION(throwScope, { });
3647 }
3648 if (!totalPausesDurationValue.isUndefined()) {
3649 result.totalPausesDuration = convert<IDLDouble>(lexicalGlobalObject, totalPausesDurationValue);
3650 RETURN_IF_EXCEPTION(throwScope, { });
3651 }
3652 JSValue trackIdentifierValue;
3653 if (isNullOrUndefined)
3654 trackIdentifierValue = jsUndefined();
3655 else {
3656 trackIdentifierValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackIdentifier"));
3657 RETURN_IF_EXCEPTION(throwScope, { });
3658 }
3659 if (!trackIdentifierValue.isUndefined()) {
3660 result.trackIdentifier = convert<IDLDOMString>(lexicalGlobalObject, trackIdentifierValue);
3661 RETURN_IF_EXCEPTION(throwScope, { });
3662 }
3663 return result;
3664}
3665
3666JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::MediaStreamTrackStats& dictionary)
3667{
3668 auto& vm = JSC::getVM(&lexicalGlobalObject);
3669 auto throwScope = DECLARE_THROW_SCOPE(vm);
3670
3671 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
3672
3673 if (!IDLDOMString::isNullValue(dictionary.id)) {
3674 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
3675 RETURN_IF_EXCEPTION(throwScope, { });
3676 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
3677 }
3678 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
3679 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
3680 RETURN_IF_EXCEPTION(throwScope, { });
3681 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
3682 }
3683 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
3684 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
3685 RETURN_IF_EXCEPTION(throwScope, { });
3686 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
3687 }
3688 if (!IDLDouble::isNullValue(dictionary.audioLevel)) {
3689 auto audioLevelValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.audioLevel));
3690 RETURN_IF_EXCEPTION(throwScope, { });
3691 result->putDirect(vm, JSC::Identifier::fromString(vm, "audioLevel"), audioLevelValue);
3692 }
3693 if (!IDLBoolean::isNullValue(dictionary.detached)) {
3694 auto detachedValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.detached));
3695 RETURN_IF_EXCEPTION(throwScope, { });
3696 result->putDirect(vm, JSC::Identifier::fromString(vm, "detached"), detachedValue);
3697 }
3698 if (!IDLDouble::isNullValue(dictionary.echoReturnLoss)) {
3699 auto echoReturnLossValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.echoReturnLoss));
3700 RETURN_IF_EXCEPTION(throwScope, { });
3701 result->putDirect(vm, JSC::Identifier::fromString(vm, "echoReturnLoss"), echoReturnLossValue);
3702 }
3703 if (!IDLDouble::isNullValue(dictionary.echoReturnLossEnhancement)) {
3704 auto echoReturnLossEnhancementValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.echoReturnLossEnhancement));
3705 RETURN_IF_EXCEPTION(throwScope, { });
3706 result->putDirect(vm, JSC::Identifier::fromString(vm, "echoReturnLossEnhancement"), echoReturnLossEnhancementValue);
3707 }
3708 if (!IDLBoolean::isNullValue(dictionary.ended)) {
3709 auto endedValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.ended));
3710 RETURN_IF_EXCEPTION(throwScope, { });
3711 result->putDirect(vm, JSC::Identifier::fromString(vm, "ended"), endedValue);
3712 }
3713 if (!IDLUnsignedLong::isNullValue(dictionary.frameHeight)) {
3714 auto frameHeightValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameHeight));
3715 RETURN_IF_EXCEPTION(throwScope, { });
3716 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameHeight"), frameHeightValue);
3717 }
3718 if (!IDLUnsignedLong::isNullValue(dictionary.frameWidth)) {
3719 auto frameWidthValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.frameWidth));
3720 RETURN_IF_EXCEPTION(throwScope, { });
3721 result->putDirect(vm, JSC::Identifier::fromString(vm, "frameWidth"), frameWidthValue);
3722 }
3723 if (!IDLUnsignedLong::isNullValue(dictionary.framesCorrupted)) {
3724 auto framesCorruptedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesCorrupted));
3725 RETURN_IF_EXCEPTION(throwScope, { });
3726 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesCorrupted"), framesCorruptedValue);
3727 }
3728 if (!IDLUnsignedLong::isNullValue(dictionary.framesDecoded)) {
3729 auto framesDecodedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDecoded));
3730 RETURN_IF_EXCEPTION(throwScope, { });
3731 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDecoded"), framesDecodedValue);
3732 }
3733 if (!IDLUnsignedLong::isNullValue(dictionary.framesDropped)) {
3734 auto framesDroppedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesDropped));
3735 RETURN_IF_EXCEPTION(throwScope, { });
3736 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesDropped"), framesDroppedValue);
3737 }
3738 if (!IDLDouble::isNullValue(dictionary.framesPerSecond)) {
3739 auto framesPerSecondValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.framesPerSecond));
3740 RETURN_IF_EXCEPTION(throwScope, { });
3741 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesPerSecond"), framesPerSecondValue);
3742 }
3743 if (!IDLUnsignedLong::isNullValue(dictionary.framesReceived)) {
3744 auto framesReceivedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesReceived));
3745 RETURN_IF_EXCEPTION(throwScope, { });
3746 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesReceived"), framesReceivedValue);
3747 }
3748 if (!IDLUnsignedLong::isNullValue(dictionary.framesSent)) {
3749 auto framesSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.framesSent));
3750 RETURN_IF_EXCEPTION(throwScope, { });
3751 result->putDirect(vm, JSC::Identifier::fromString(vm, "framesSent"), framesSentValue);
3752 }
3753 if (!IDLUnsignedLong::isNullValue(dictionary.freezeCount)) {
3754 auto freezeCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.freezeCount));
3755 RETURN_IF_EXCEPTION(throwScope, { });
3756 result->putDirect(vm, JSC::Identifier::fromString(vm, "freezeCount"), freezeCountValue);
3757 }
3758 if (!IDLUnsignedLong::isNullValue(dictionary.fullFramesLost)) {
3759 auto fullFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.fullFramesLost));
3760 RETURN_IF_EXCEPTION(throwScope, { });
3761 result->putDirect(vm, JSC::Identifier::fromString(vm, "fullFramesLost"), fullFramesLostValue);
3762 }
3763 if (!IDLUnsignedLongLong::isNullValue(dictionary.jitterBufferFlushes)) {
3764 auto jitterBufferFlushesValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.jitterBufferFlushes));
3765 RETURN_IF_EXCEPTION(throwScope, { });
3766 result->putDirect(vm, JSC::Identifier::fromString(vm, "jitterBufferFlushes"), jitterBufferFlushesValue);
3767 }
3768 if (!IDLUnsignedLong::isNullValue(dictionary.partialFramesLost)) {
3769 auto partialFramesLostValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.partialFramesLost));
3770 RETURN_IF_EXCEPTION(throwScope, { });
3771 result->putDirect(vm, JSC::Identifier::fromString(vm, "partialFramesLost"), partialFramesLostValue);
3772 }
3773 if (!IDLUnsignedLong::isNullValue(dictionary.pauseCount)) {
3774 auto pauseCountValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.pauseCount));
3775 RETURN_IF_EXCEPTION(throwScope, { });
3776 result->putDirect(vm, JSC::Identifier::fromString(vm, "pauseCount"), pauseCountValue);
3777 }
3778 if (!IDLBoolean::isNullValue(dictionary.remoteSource)) {
3779 auto remoteSourceValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.remoteSource));
3780 RETURN_IF_EXCEPTION(throwScope, { });
3781 result->putDirect(vm, JSC::Identifier::fromString(vm, "remoteSource"), remoteSourceValue);
3782 }
3783 if (!IDLDouble::isNullValue(dictionary.sumOfSquaredFramesDuration)) {
3784 auto sumOfSquaredFramesDurationValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.sumOfSquaredFramesDuration));
3785 RETURN_IF_EXCEPTION(throwScope, { });
3786 result->putDirect(vm, JSC::Identifier::fromString(vm, "sumOfSquaredFramesDuration"), sumOfSquaredFramesDurationValue);
3787 }
3788 if (!IDLDouble::isNullValue(dictionary.totalFramesDuration)) {
3789 auto totalFramesDurationValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalFramesDuration));
3790 RETURN_IF_EXCEPTION(throwScope, { });
3791 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalFramesDuration"), totalFramesDurationValue);
3792 }
3793 if (!IDLDouble::isNullValue(dictionary.totalFreezesDuration)) {
3794 auto totalFreezesDurationValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalFreezesDuration));
3795 RETURN_IF_EXCEPTION(throwScope, { });
3796 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalFreezesDuration"), totalFreezesDurationValue);
3797 }
3798 if (!IDLDouble::isNullValue(dictionary.totalPausesDuration)) {
3799 auto totalPausesDurationValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalPausesDuration));
3800 RETURN_IF_EXCEPTION(throwScope, { });
3801 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalPausesDuration"), totalPausesDurationValue);
3802 }
3803 if (!IDLDOMString::isNullValue(dictionary.trackIdentifier)) {
3804 auto trackIdentifierValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.trackIdentifier));
3805 RETURN_IF_EXCEPTION(throwScope, { });
3806 result->putDirect(vm, JSC::Identifier::fromString(vm, "trackIdentifier"), trackIdentifierValue);
3807 }
3808 return result;
3809}
3810
3811template<> RTCStatsReport::DataChannelStats convertDictionary<RTCStatsReport::DataChannelStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
3812{
3813 VM& vm = JSC::getVM(&lexicalGlobalObject);
3814 auto throwScope = DECLARE_THROW_SCOPE(vm);
3815 bool isNullOrUndefined = value.isUndefinedOrNull();
3816 auto* object = isNullOrUndefined ? nullptr : value.getObject();
3817 if (UNLIKELY(!isNullOrUndefined && !object)) {
3818 throwTypeError(&lexicalGlobalObject, throwScope);
3819 return { };
3820 }
3821 RTCStatsReport::DataChannelStats result;
3822 JSValue idValue;
3823 if (isNullOrUndefined)
3824 idValue = jsUndefined();
3825 else {
3826 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
3827 RETURN_IF_EXCEPTION(throwScope, { });
3828 }
3829 if (!idValue.isUndefined()) {
3830 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
3831 RETURN_IF_EXCEPTION(throwScope, { });
3832 }
3833 JSValue timestampValue;
3834 if (isNullOrUndefined)
3835 timestampValue = jsUndefined();
3836 else {
3837 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
3838 RETURN_IF_EXCEPTION(throwScope, { });
3839 }
3840 if (!timestampValue.isUndefined()) {
3841 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
3842 RETURN_IF_EXCEPTION(throwScope, { });
3843 }
3844 JSValue typeValue;
3845 if (isNullOrUndefined)
3846 typeValue = jsUndefined();
3847 else {
3848 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
3849 RETURN_IF_EXCEPTION(throwScope, { });
3850 }
3851 if (!typeValue.isUndefined()) {
3852 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
3853 RETURN_IF_EXCEPTION(throwScope, { });
3854 }
3855 JSValue bytesReceivedValue;
3856 if (isNullOrUndefined)
3857 bytesReceivedValue = jsUndefined();
3858 else {
3859 bytesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesReceived"));
3860 RETURN_IF_EXCEPTION(throwScope, { });
3861 }
3862 if (!bytesReceivedValue.isUndefined()) {
3863 result.bytesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesReceivedValue);
3864 RETURN_IF_EXCEPTION(throwScope, { });
3865 }
3866 JSValue bytesSentValue;
3867 if (isNullOrUndefined)
3868 bytesSentValue = jsUndefined();
3869 else {
3870 bytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesSent"));
3871 RETURN_IF_EXCEPTION(throwScope, { });
3872 }
3873 if (!bytesSentValue.isUndefined()) {
3874 result.bytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesSentValue);
3875 RETURN_IF_EXCEPTION(throwScope, { });
3876 }
3877 JSValue datachannelidValue;
3878 if (isNullOrUndefined)
3879 datachannelidValue = jsUndefined();
3880 else {
3881 datachannelidValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "datachannelid"));
3882 RETURN_IF_EXCEPTION(throwScope, { });
3883 }
3884 if (!datachannelidValue.isUndefined()) {
3885 result.datachannelid = convert<IDLLong>(lexicalGlobalObject, datachannelidValue);
3886 RETURN_IF_EXCEPTION(throwScope, { });
3887 }
3888 JSValue labelValue;
3889 if (isNullOrUndefined)
3890 labelValue = jsUndefined();
3891 else {
3892 labelValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "label"));
3893 RETURN_IF_EXCEPTION(throwScope, { });
3894 }
3895 if (!labelValue.isUndefined()) {
3896 result.label = convert<IDLDOMString>(lexicalGlobalObject, labelValue);
3897 RETURN_IF_EXCEPTION(throwScope, { });
3898 }
3899 JSValue messagesReceivedValue;
3900 if (isNullOrUndefined)
3901 messagesReceivedValue = jsUndefined();
3902 else {
3903 messagesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "messagesReceived"));
3904 RETURN_IF_EXCEPTION(throwScope, { });
3905 }
3906 if (!messagesReceivedValue.isUndefined()) {
3907 result.messagesReceived = convert<IDLUnsignedLong>(lexicalGlobalObject, messagesReceivedValue);
3908 RETURN_IF_EXCEPTION(throwScope, { });
3909 }
3910 JSValue messagesSentValue;
3911 if (isNullOrUndefined)
3912 messagesSentValue = jsUndefined();
3913 else {
3914 messagesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "messagesSent"));
3915 RETURN_IF_EXCEPTION(throwScope, { });
3916 }
3917 if (!messagesSentValue.isUndefined()) {
3918 result.messagesSent = convert<IDLUnsignedLong>(lexicalGlobalObject, messagesSentValue);
3919 RETURN_IF_EXCEPTION(throwScope, { });
3920 }
3921 JSValue protocolValue;
3922 if (isNullOrUndefined)
3923 protocolValue = jsUndefined();
3924 else {
3925 protocolValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "protocol"));
3926 RETURN_IF_EXCEPTION(throwScope, { });
3927 }
3928 if (!protocolValue.isUndefined()) {
3929 result.protocol = convert<IDLDOMString>(lexicalGlobalObject, protocolValue);
3930 RETURN_IF_EXCEPTION(throwScope, { });
3931 }
3932 JSValue stateValue;
3933 if (isNullOrUndefined)
3934 stateValue = jsUndefined();
3935 else {
3936 stateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "state"));
3937 RETURN_IF_EXCEPTION(throwScope, { });
3938 }
3939 if (!stateValue.isUndefined()) {
3940 result.state = convert<IDLDOMString>(lexicalGlobalObject, stateValue);
3941 RETURN_IF_EXCEPTION(throwScope, { });
3942 }
3943 return result;
3944}
3945
3946JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::DataChannelStats& dictionary)
3947{
3948 auto& vm = JSC::getVM(&lexicalGlobalObject);
3949 auto throwScope = DECLARE_THROW_SCOPE(vm);
3950
3951 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
3952
3953 if (!IDLDOMString::isNullValue(dictionary.id)) {
3954 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
3955 RETURN_IF_EXCEPTION(throwScope, { });
3956 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
3957 }
3958 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
3959 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
3960 RETURN_IF_EXCEPTION(throwScope, { });
3961 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
3962 }
3963 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
3964 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
3965 RETURN_IF_EXCEPTION(throwScope, { });
3966 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
3967 }
3968 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesReceived)) {
3969 auto bytesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesReceived));
3970 RETURN_IF_EXCEPTION(throwScope, { });
3971 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesReceived"), bytesReceivedValue);
3972 }
3973 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesSent)) {
3974 auto bytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesSent));
3975 RETURN_IF_EXCEPTION(throwScope, { });
3976 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesSent"), bytesSentValue);
3977 }
3978 if (!IDLLong::isNullValue(dictionary.datachannelid)) {
3979 auto datachannelidValue = toJS<IDLLong>(lexicalGlobalObject, throwScope, IDLLong::extractValueFromNullable(dictionary.datachannelid));
3980 RETURN_IF_EXCEPTION(throwScope, { });
3981 result->putDirect(vm, JSC::Identifier::fromString(vm, "datachannelid"), datachannelidValue);
3982 }
3983 if (!IDLDOMString::isNullValue(dictionary.label)) {
3984 auto labelValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.label));
3985 RETURN_IF_EXCEPTION(throwScope, { });
3986 result->putDirect(vm, JSC::Identifier::fromString(vm, "label"), labelValue);
3987 }
3988 if (!IDLUnsignedLong::isNullValue(dictionary.messagesReceived)) {
3989 auto messagesReceivedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.messagesReceived));
3990 RETURN_IF_EXCEPTION(throwScope, { });
3991 result->putDirect(vm, JSC::Identifier::fromString(vm, "messagesReceived"), messagesReceivedValue);
3992 }
3993 if (!IDLUnsignedLong::isNullValue(dictionary.messagesSent)) {
3994 auto messagesSentValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.messagesSent));
3995 RETURN_IF_EXCEPTION(throwScope, { });
3996 result->putDirect(vm, JSC::Identifier::fromString(vm, "messagesSent"), messagesSentValue);
3997 }
3998 if (!IDLDOMString::isNullValue(dictionary.protocol)) {
3999 auto protocolValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.protocol));
4000 RETURN_IF_EXCEPTION(throwScope, { });
4001 result->putDirect(vm, JSC::Identifier::fromString(vm, "protocol"), protocolValue);
4002 }
4003 if (!IDLDOMString::isNullValue(dictionary.state)) {
4004 auto stateValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.state));
4005 RETURN_IF_EXCEPTION(throwScope, { });
4006 result->putDirect(vm, JSC::Identifier::fromString(vm, "state"), stateValue);
4007 }
4008 return result;
4009}
4010
4011template<> RTCStatsReport::IceCandidatePairStats convertDictionary<RTCStatsReport::IceCandidatePairStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
4012{
4013 VM& vm = JSC::getVM(&lexicalGlobalObject);
4014 auto throwScope = DECLARE_THROW_SCOPE(vm);
4015 bool isNullOrUndefined = value.isUndefinedOrNull();
4016 auto* object = isNullOrUndefined ? nullptr : value.getObject();
4017 if (UNLIKELY(!isNullOrUndefined && !object)) {
4018 throwTypeError(&lexicalGlobalObject, throwScope);
4019 return { };
4020 }
4021 RTCStatsReport::IceCandidatePairStats result;
4022 JSValue idValue;
4023 if (isNullOrUndefined)
4024 idValue = jsUndefined();
4025 else {
4026 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
4027 RETURN_IF_EXCEPTION(throwScope, { });
4028 }
4029 if (!idValue.isUndefined()) {
4030 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
4031 RETURN_IF_EXCEPTION(throwScope, { });
4032 }
4033 JSValue timestampValue;
4034 if (isNullOrUndefined)
4035 timestampValue = jsUndefined();
4036 else {
4037 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
4038 RETURN_IF_EXCEPTION(throwScope, { });
4039 }
4040 if (!timestampValue.isUndefined()) {
4041 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
4042 RETURN_IF_EXCEPTION(throwScope, { });
4043 }
4044 JSValue typeValue;
4045 if (isNullOrUndefined)
4046 typeValue = jsUndefined();
4047 else {
4048 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
4049 RETURN_IF_EXCEPTION(throwScope, { });
4050 }
4051 if (!typeValue.isUndefined()) {
4052 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
4053 RETURN_IF_EXCEPTION(throwScope, { });
4054 }
4055 JSValue availableIncomingBitrateValue;
4056 if (isNullOrUndefined)
4057 availableIncomingBitrateValue = jsUndefined();
4058 else {
4059 availableIncomingBitrateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "availableIncomingBitrate"));
4060 RETURN_IF_EXCEPTION(throwScope, { });
4061 }
4062 if (!availableIncomingBitrateValue.isUndefined()) {
4063 result.availableIncomingBitrate = convert<IDLDouble>(lexicalGlobalObject, availableIncomingBitrateValue);
4064 RETURN_IF_EXCEPTION(throwScope, { });
4065 }
4066 JSValue availableOutgoingBitrateValue;
4067 if (isNullOrUndefined)
4068 availableOutgoingBitrateValue = jsUndefined();
4069 else {
4070 availableOutgoingBitrateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "availableOutgoingBitrate"));
4071 RETURN_IF_EXCEPTION(throwScope, { });
4072 }
4073 if (!availableOutgoingBitrateValue.isUndefined()) {
4074 result.availableOutgoingBitrate = convert<IDLDouble>(lexicalGlobalObject, availableOutgoingBitrateValue);
4075 RETURN_IF_EXCEPTION(throwScope, { });
4076 }
4077 JSValue bytesReceivedValue;
4078 if (isNullOrUndefined)
4079 bytesReceivedValue = jsUndefined();
4080 else {
4081 bytesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesReceived"));
4082 RETURN_IF_EXCEPTION(throwScope, { });
4083 }
4084 if (!bytesReceivedValue.isUndefined()) {
4085 result.bytesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesReceivedValue);
4086 RETURN_IF_EXCEPTION(throwScope, { });
4087 }
4088 JSValue bytesSentValue;
4089 if (isNullOrUndefined)
4090 bytesSentValue = jsUndefined();
4091 else {
4092 bytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesSent"));
4093 RETURN_IF_EXCEPTION(throwScope, { });
4094 }
4095 if (!bytesSentValue.isUndefined()) {
4096 result.bytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesSentValue);
4097 RETURN_IF_EXCEPTION(throwScope, { });
4098 }
4099 JSValue currentRoundTripTimeValue;
4100 if (isNullOrUndefined)
4101 currentRoundTripTimeValue = jsUndefined();
4102 else {
4103 currentRoundTripTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "currentRoundTripTime"));
4104 RETURN_IF_EXCEPTION(throwScope, { });
4105 }
4106 if (!currentRoundTripTimeValue.isUndefined()) {
4107 result.currentRoundTripTime = convert<IDLDouble>(lexicalGlobalObject, currentRoundTripTimeValue);
4108 RETURN_IF_EXCEPTION(throwScope, { });
4109 }
4110 JSValue localCandidateIdValue;
4111 if (isNullOrUndefined)
4112 localCandidateIdValue = jsUndefined();
4113 else {
4114 localCandidateIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "localCandidateId"));
4115 RETURN_IF_EXCEPTION(throwScope, { });
4116 }
4117 if (!localCandidateIdValue.isUndefined()) {
4118 result.localCandidateId = convert<IDLDOMString>(lexicalGlobalObject, localCandidateIdValue);
4119 RETURN_IF_EXCEPTION(throwScope, { });
4120 }
4121 JSValue nominatedValue;
4122 if (isNullOrUndefined)
4123 nominatedValue = jsUndefined();
4124 else {
4125 nominatedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "nominated"));
4126 RETURN_IF_EXCEPTION(throwScope, { });
4127 }
4128 if (!nominatedValue.isUndefined()) {
4129 result.nominated = convert<IDLBoolean>(lexicalGlobalObject, nominatedValue);
4130 RETURN_IF_EXCEPTION(throwScope, { });
4131 }
4132 JSValue priorityValue;
4133 if (isNullOrUndefined)
4134 priorityValue = jsUndefined();
4135 else {
4136 priorityValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "priority"));
4137 RETURN_IF_EXCEPTION(throwScope, { });
4138 }
4139 if (!priorityValue.isUndefined()) {
4140 result.priority = convert<IDLUnsignedLongLong>(lexicalGlobalObject, priorityValue);
4141 RETURN_IF_EXCEPTION(throwScope, { });
4142 }
4143 JSValue readableValue;
4144 if (isNullOrUndefined)
4145 readableValue = jsUndefined();
4146 else {
4147 readableValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "readable"));
4148 RETURN_IF_EXCEPTION(throwScope, { });
4149 }
4150 if (!readableValue.isUndefined()) {
4151 result.readable = convert<IDLBoolean>(lexicalGlobalObject, readableValue);
4152 RETURN_IF_EXCEPTION(throwScope, { });
4153 }
4154 JSValue remoteCandidateIdValue;
4155 if (isNullOrUndefined)
4156 remoteCandidateIdValue = jsUndefined();
4157 else {
4158 remoteCandidateIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "remoteCandidateId"));
4159 RETURN_IF_EXCEPTION(throwScope, { });
4160 }
4161 if (!remoteCandidateIdValue.isUndefined()) {
4162 result.remoteCandidateId = convert<IDLDOMString>(lexicalGlobalObject, remoteCandidateIdValue);
4163 RETURN_IF_EXCEPTION(throwScope, { });
4164 }
4165 JSValue requestsReceivedValue;
4166 if (isNullOrUndefined)
4167 requestsReceivedValue = jsUndefined();
4168 else {
4169 requestsReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "requestsReceived"));
4170 RETURN_IF_EXCEPTION(throwScope, { });
4171 }
4172 if (!requestsReceivedValue.isUndefined()) {
4173 result.requestsReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, requestsReceivedValue);
4174 RETURN_IF_EXCEPTION(throwScope, { });
4175 }
4176 JSValue requestsSentValue;
4177 if (isNullOrUndefined)
4178 requestsSentValue = jsUndefined();
4179 else {
4180 requestsSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "requestsSent"));
4181 RETURN_IF_EXCEPTION(throwScope, { });
4182 }
4183 if (!requestsSentValue.isUndefined()) {
4184 result.requestsSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, requestsSentValue);
4185 RETURN_IF_EXCEPTION(throwScope, { });
4186 }
4187 JSValue responsesReceivedValue;
4188 if (isNullOrUndefined)
4189 responsesReceivedValue = jsUndefined();
4190 else {
4191 responsesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "responsesReceived"));
4192 RETURN_IF_EXCEPTION(throwScope, { });
4193 }
4194 if (!responsesReceivedValue.isUndefined()) {
4195 result.responsesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, responsesReceivedValue);
4196 RETURN_IF_EXCEPTION(throwScope, { });
4197 }
4198 JSValue responsesSentValue;
4199 if (isNullOrUndefined)
4200 responsesSentValue = jsUndefined();
4201 else {
4202 responsesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "responsesSent"));
4203 RETURN_IF_EXCEPTION(throwScope, { });
4204 }
4205 if (!responsesSentValue.isUndefined()) {
4206 result.responsesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, responsesSentValue);
4207 RETURN_IF_EXCEPTION(throwScope, { });
4208 }
4209 JSValue stateValue;
4210 if (isNullOrUndefined)
4211 stateValue = jsUndefined();
4212 else {
4213 stateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "state"));
4214 RETURN_IF_EXCEPTION(throwScope, { });
4215 }
4216 if (!stateValue.isUndefined()) {
4217 result.state = convert<IDLEnumeration<RTCStatsReport::IceCandidatePairState>>(lexicalGlobalObject, stateValue);
4218 RETURN_IF_EXCEPTION(throwScope, { });
4219 }
4220 JSValue totalRoundTripTimeValue;
4221 if (isNullOrUndefined)
4222 totalRoundTripTimeValue = jsUndefined();
4223 else {
4224 totalRoundTripTimeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalRoundTripTime"));
4225 RETURN_IF_EXCEPTION(throwScope, { });
4226 }
4227 if (!totalRoundTripTimeValue.isUndefined()) {
4228 result.totalRoundTripTime = convert<IDLDouble>(lexicalGlobalObject, totalRoundTripTimeValue);
4229 RETURN_IF_EXCEPTION(throwScope, { });
4230 }
4231 JSValue transportIdValue;
4232 if (isNullOrUndefined)
4233 transportIdValue = jsUndefined();
4234 else {
4235 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
4236 RETURN_IF_EXCEPTION(throwScope, { });
4237 }
4238 if (!transportIdValue.isUndefined()) {
4239 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
4240 RETURN_IF_EXCEPTION(throwScope, { });
4241 }
4242 JSValue writableValue;
4243 if (isNullOrUndefined)
4244 writableValue = jsUndefined();
4245 else {
4246 writableValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "writable"));
4247 RETURN_IF_EXCEPTION(throwScope, { });
4248 }
4249 if (!writableValue.isUndefined()) {
4250 result.writable = convert<IDLBoolean>(lexicalGlobalObject, writableValue);
4251 RETURN_IF_EXCEPTION(throwScope, { });
4252 }
4253 return result;
4254}
4255
4256JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::IceCandidatePairStats& dictionary)
4257{
4258 auto& vm = JSC::getVM(&lexicalGlobalObject);
4259 auto throwScope = DECLARE_THROW_SCOPE(vm);
4260
4261 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
4262
4263 if (!IDLDOMString::isNullValue(dictionary.id)) {
4264 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
4265 RETURN_IF_EXCEPTION(throwScope, { });
4266 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
4267 }
4268 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
4269 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
4270 RETURN_IF_EXCEPTION(throwScope, { });
4271 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
4272 }
4273 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
4274 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
4275 RETURN_IF_EXCEPTION(throwScope, { });
4276 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
4277 }
4278 if (!IDLDouble::isNullValue(dictionary.availableIncomingBitrate)) {
4279 auto availableIncomingBitrateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.availableIncomingBitrate));
4280 RETURN_IF_EXCEPTION(throwScope, { });
4281 result->putDirect(vm, JSC::Identifier::fromString(vm, "availableIncomingBitrate"), availableIncomingBitrateValue);
4282 }
4283 if (!IDLDouble::isNullValue(dictionary.availableOutgoingBitrate)) {
4284 auto availableOutgoingBitrateValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.availableOutgoingBitrate));
4285 RETURN_IF_EXCEPTION(throwScope, { });
4286 result->putDirect(vm, JSC::Identifier::fromString(vm, "availableOutgoingBitrate"), availableOutgoingBitrateValue);
4287 }
4288 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesReceived)) {
4289 auto bytesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesReceived));
4290 RETURN_IF_EXCEPTION(throwScope, { });
4291 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesReceived"), bytesReceivedValue);
4292 }
4293 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesSent)) {
4294 auto bytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesSent));
4295 RETURN_IF_EXCEPTION(throwScope, { });
4296 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesSent"), bytesSentValue);
4297 }
4298 if (!IDLDouble::isNullValue(dictionary.currentRoundTripTime)) {
4299 auto currentRoundTripTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.currentRoundTripTime));
4300 RETURN_IF_EXCEPTION(throwScope, { });
4301 result->putDirect(vm, JSC::Identifier::fromString(vm, "currentRoundTripTime"), currentRoundTripTimeValue);
4302 }
4303 if (!IDLDOMString::isNullValue(dictionary.localCandidateId)) {
4304 auto localCandidateIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.localCandidateId));
4305 RETURN_IF_EXCEPTION(throwScope, { });
4306 result->putDirect(vm, JSC::Identifier::fromString(vm, "localCandidateId"), localCandidateIdValue);
4307 }
4308 if (!IDLBoolean::isNullValue(dictionary.nominated)) {
4309 auto nominatedValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.nominated));
4310 RETURN_IF_EXCEPTION(throwScope, { });
4311 result->putDirect(vm, JSC::Identifier::fromString(vm, "nominated"), nominatedValue);
4312 }
4313 if (!IDLUnsignedLongLong::isNullValue(dictionary.priority)) {
4314 auto priorityValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.priority));
4315 RETURN_IF_EXCEPTION(throwScope, { });
4316 result->putDirect(vm, JSC::Identifier::fromString(vm, "priority"), priorityValue);
4317 }
4318 if (!IDLBoolean::isNullValue(dictionary.readable)) {
4319 auto readableValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.readable));
4320 RETURN_IF_EXCEPTION(throwScope, { });
4321 result->putDirect(vm, JSC::Identifier::fromString(vm, "readable"), readableValue);
4322 }
4323 if (!IDLDOMString::isNullValue(dictionary.remoteCandidateId)) {
4324 auto remoteCandidateIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.remoteCandidateId));
4325 RETURN_IF_EXCEPTION(throwScope, { });
4326 result->putDirect(vm, JSC::Identifier::fromString(vm, "remoteCandidateId"), remoteCandidateIdValue);
4327 }
4328 if (!IDLUnsignedLongLong::isNullValue(dictionary.requestsReceived)) {
4329 auto requestsReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.requestsReceived));
4330 RETURN_IF_EXCEPTION(throwScope, { });
4331 result->putDirect(vm, JSC::Identifier::fromString(vm, "requestsReceived"), requestsReceivedValue);
4332 }
4333 if (!IDLUnsignedLongLong::isNullValue(dictionary.requestsSent)) {
4334 auto requestsSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.requestsSent));
4335 RETURN_IF_EXCEPTION(throwScope, { });
4336 result->putDirect(vm, JSC::Identifier::fromString(vm, "requestsSent"), requestsSentValue);
4337 }
4338 if (!IDLUnsignedLongLong::isNullValue(dictionary.responsesReceived)) {
4339 auto responsesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.responsesReceived));
4340 RETURN_IF_EXCEPTION(throwScope, { });
4341 result->putDirect(vm, JSC::Identifier::fromString(vm, "responsesReceived"), responsesReceivedValue);
4342 }
4343 if (!IDLUnsignedLongLong::isNullValue(dictionary.responsesSent)) {
4344 auto responsesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.responsesSent));
4345 RETURN_IF_EXCEPTION(throwScope, { });
4346 result->putDirect(vm, JSC::Identifier::fromString(vm, "responsesSent"), responsesSentValue);
4347 }
4348 if (!IDLEnumeration<RTCStatsReport::IceCandidatePairState>::isNullValue(dictionary.state)) {
4349 auto stateValue = toJS<IDLEnumeration<RTCStatsReport::IceCandidatePairState>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::IceCandidatePairState>::extractValueFromNullable(dictionary.state));
4350 RETURN_IF_EXCEPTION(throwScope, { });
4351 result->putDirect(vm, JSC::Identifier::fromString(vm, "state"), stateValue);
4352 }
4353 if (!IDLDouble::isNullValue(dictionary.totalRoundTripTime)) {
4354 auto totalRoundTripTimeValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.totalRoundTripTime));
4355 RETURN_IF_EXCEPTION(throwScope, { });
4356 result->putDirect(vm, JSC::Identifier::fromString(vm, "totalRoundTripTime"), totalRoundTripTimeValue);
4357 }
4358 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
4359 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
4360 RETURN_IF_EXCEPTION(throwScope, { });
4361 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
4362 }
4363 if (!IDLBoolean::isNullValue(dictionary.writable)) {
4364 auto writableValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.writable));
4365 RETURN_IF_EXCEPTION(throwScope, { });
4366 result->putDirect(vm, JSC::Identifier::fromString(vm, "writable"), writableValue);
4367 }
4368 return result;
4369}
4370
4371template<> RTCStatsReport::IceCandidateStats convertDictionary<RTCStatsReport::IceCandidateStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
4372{
4373 VM& vm = JSC::getVM(&lexicalGlobalObject);
4374 auto throwScope = DECLARE_THROW_SCOPE(vm);
4375 bool isNullOrUndefined = value.isUndefinedOrNull();
4376 auto* object = isNullOrUndefined ? nullptr : value.getObject();
4377 if (UNLIKELY(!isNullOrUndefined && !object)) {
4378 throwTypeError(&lexicalGlobalObject, throwScope);
4379 return { };
4380 }
4381 RTCStatsReport::IceCandidateStats result;
4382 JSValue idValue;
4383 if (isNullOrUndefined)
4384 idValue = jsUndefined();
4385 else {
4386 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
4387 RETURN_IF_EXCEPTION(throwScope, { });
4388 }
4389 if (!idValue.isUndefined()) {
4390 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
4391 RETURN_IF_EXCEPTION(throwScope, { });
4392 }
4393 JSValue timestampValue;
4394 if (isNullOrUndefined)
4395 timestampValue = jsUndefined();
4396 else {
4397 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
4398 RETURN_IF_EXCEPTION(throwScope, { });
4399 }
4400 if (!timestampValue.isUndefined()) {
4401 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
4402 RETURN_IF_EXCEPTION(throwScope, { });
4403 }
4404 JSValue typeValue;
4405 if (isNullOrUndefined)
4406 typeValue = jsUndefined();
4407 else {
4408 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
4409 RETURN_IF_EXCEPTION(throwScope, { });
4410 }
4411 if (!typeValue.isUndefined()) {
4412 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
4413 RETURN_IF_EXCEPTION(throwScope, { });
4414 }
4415 JSValue addressValue;
4416 if (isNullOrUndefined)
4417 addressValue = jsUndefined();
4418 else {
4419 addressValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "address"));
4420 RETURN_IF_EXCEPTION(throwScope, { });
4421 }
4422 if (!addressValue.isUndefined()) {
4423 result.address = convert<IDLDOMString>(lexicalGlobalObject, addressValue);
4424 RETURN_IF_EXCEPTION(throwScope, { });
4425 }
4426 JSValue candidateTypeValue;
4427 if (isNullOrUndefined)
4428 candidateTypeValue = jsUndefined();
4429 else {
4430 candidateTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "candidateType"));
4431 RETURN_IF_EXCEPTION(throwScope, { });
4432 }
4433 if (!candidateTypeValue.isUndefined()) {
4434 result.candidateType = convert<IDLEnumeration<RTCIceCandidateType>>(lexicalGlobalObject, candidateTypeValue);
4435 RETURN_IF_EXCEPTION(throwScope, { });
4436 }
4437 JSValue deletedValue;
4438 if (isNullOrUndefined)
4439 deletedValue = jsUndefined();
4440 else {
4441 deletedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "deleted"));
4442 RETURN_IF_EXCEPTION(throwScope, { });
4443 }
4444 if (!deletedValue.isUndefined()) {
4445 result.deleted = convert<IDLBoolean>(lexicalGlobalObject, deletedValue);
4446 RETURN_IF_EXCEPTION(throwScope, { });
4447 } else
4448 result.deleted = false;
4449 JSValue portValue;
4450 if (isNullOrUndefined)
4451 portValue = jsUndefined();
4452 else {
4453 portValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "port"));
4454 RETURN_IF_EXCEPTION(throwScope, { });
4455 }
4456 if (!portValue.isUndefined()) {
4457 result.port = convert<IDLLong>(lexicalGlobalObject, portValue);
4458 RETURN_IF_EXCEPTION(throwScope, { });
4459 }
4460 JSValue priorityValue;
4461 if (isNullOrUndefined)
4462 priorityValue = jsUndefined();
4463 else {
4464 priorityValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "priority"));
4465 RETURN_IF_EXCEPTION(throwScope, { });
4466 }
4467 if (!priorityValue.isUndefined()) {
4468 result.priority = convert<IDLLong>(lexicalGlobalObject, priorityValue);
4469 RETURN_IF_EXCEPTION(throwScope, { });
4470 }
4471 JSValue protocolValue;
4472 if (isNullOrUndefined)
4473 protocolValue = jsUndefined();
4474 else {
4475 protocolValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "protocol"));
4476 RETURN_IF_EXCEPTION(throwScope, { });
4477 }
4478 if (!protocolValue.isUndefined()) {
4479 result.protocol = convert<IDLDOMString>(lexicalGlobalObject, protocolValue);
4480 RETURN_IF_EXCEPTION(throwScope, { });
4481 }
4482 JSValue transportIdValue;
4483 if (isNullOrUndefined)
4484 transportIdValue = jsUndefined();
4485 else {
4486 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
4487 RETURN_IF_EXCEPTION(throwScope, { });
4488 }
4489 if (!transportIdValue.isUndefined()) {
4490 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
4491 RETURN_IF_EXCEPTION(throwScope, { });
4492 }
4493 JSValue urlValue;
4494 if (isNullOrUndefined)
4495 urlValue = jsUndefined();
4496 else {
4497 urlValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "url"));
4498 RETURN_IF_EXCEPTION(throwScope, { });
4499 }
4500 if (!urlValue.isUndefined()) {
4501 result.url = convert<IDLDOMString>(lexicalGlobalObject, urlValue);
4502 RETURN_IF_EXCEPTION(throwScope, { });
4503 }
4504 return result;
4505}
4506
4507JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::IceCandidateStats& dictionary)
4508{
4509 auto& vm = JSC::getVM(&lexicalGlobalObject);
4510 auto throwScope = DECLARE_THROW_SCOPE(vm);
4511
4512 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
4513
4514 if (!IDLDOMString::isNullValue(dictionary.id)) {
4515 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
4516 RETURN_IF_EXCEPTION(throwScope, { });
4517 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
4518 }
4519 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
4520 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
4521 RETURN_IF_EXCEPTION(throwScope, { });
4522 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
4523 }
4524 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
4525 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
4526 RETURN_IF_EXCEPTION(throwScope, { });
4527 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
4528 }
4529 if (!IDLDOMString::isNullValue(dictionary.address)) {
4530 auto addressValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.address));
4531 RETURN_IF_EXCEPTION(throwScope, { });
4532 result->putDirect(vm, JSC::Identifier::fromString(vm, "address"), addressValue);
4533 }
4534 if (!IDLEnumeration<RTCIceCandidateType>::isNullValue(dictionary.candidateType)) {
4535 auto candidateTypeValue = toJS<IDLEnumeration<RTCIceCandidateType>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCIceCandidateType>::extractValueFromNullable(dictionary.candidateType));
4536 RETURN_IF_EXCEPTION(throwScope, { });
4537 result->putDirect(vm, JSC::Identifier::fromString(vm, "candidateType"), candidateTypeValue);
4538 }
4539 auto deletedValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, dictionary.deleted);
4540 RETURN_IF_EXCEPTION(throwScope, { });
4541 result->putDirect(vm, JSC::Identifier::fromString(vm, "deleted"), deletedValue);
4542 if (!IDLLong::isNullValue(dictionary.port)) {
4543 auto portValue = toJS<IDLLong>(lexicalGlobalObject, throwScope, IDLLong::extractValueFromNullable(dictionary.port));
4544 RETURN_IF_EXCEPTION(throwScope, { });
4545 result->putDirect(vm, JSC::Identifier::fromString(vm, "port"), portValue);
4546 }
4547 if (!IDLLong::isNullValue(dictionary.priority)) {
4548 auto priorityValue = toJS<IDLLong>(lexicalGlobalObject, throwScope, IDLLong::extractValueFromNullable(dictionary.priority));
4549 RETURN_IF_EXCEPTION(throwScope, { });
4550 result->putDirect(vm, JSC::Identifier::fromString(vm, "priority"), priorityValue);
4551 }
4552 if (!IDLDOMString::isNullValue(dictionary.protocol)) {
4553 auto protocolValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.protocol));
4554 RETURN_IF_EXCEPTION(throwScope, { });
4555 result->putDirect(vm, JSC::Identifier::fromString(vm, "protocol"), protocolValue);
4556 }
4557 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
4558 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
4559 RETURN_IF_EXCEPTION(throwScope, { });
4560 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
4561 }
4562 if (!IDLDOMString::isNullValue(dictionary.url)) {
4563 auto urlValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.url));
4564 RETURN_IF_EXCEPTION(throwScope, { });
4565 result->putDirect(vm, JSC::Identifier::fromString(vm, "url"), urlValue);
4566 }
4567 return result;
4568}
4569
4570template<> RTCStatsReport::CertificateStats convertDictionary<RTCStatsReport::CertificateStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
4571{
4572 VM& vm = JSC::getVM(&lexicalGlobalObject);
4573 auto throwScope = DECLARE_THROW_SCOPE(vm);
4574 bool isNullOrUndefined = value.isUndefinedOrNull();
4575 auto* object = isNullOrUndefined ? nullptr : value.getObject();
4576 if (UNLIKELY(!isNullOrUndefined && !object)) {
4577 throwTypeError(&lexicalGlobalObject, throwScope);
4578 return { };
4579 }
4580 RTCStatsReport::CertificateStats result;
4581 JSValue idValue;
4582 if (isNullOrUndefined)
4583 idValue = jsUndefined();
4584 else {
4585 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
4586 RETURN_IF_EXCEPTION(throwScope, { });
4587 }
4588 if (!idValue.isUndefined()) {
4589 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
4590 RETURN_IF_EXCEPTION(throwScope, { });
4591 }
4592 JSValue timestampValue;
4593 if (isNullOrUndefined)
4594 timestampValue = jsUndefined();
4595 else {
4596 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
4597 RETURN_IF_EXCEPTION(throwScope, { });
4598 }
4599 if (!timestampValue.isUndefined()) {
4600 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
4601 RETURN_IF_EXCEPTION(throwScope, { });
4602 }
4603 JSValue typeValue;
4604 if (isNullOrUndefined)
4605 typeValue = jsUndefined();
4606 else {
4607 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
4608 RETURN_IF_EXCEPTION(throwScope, { });
4609 }
4610 if (!typeValue.isUndefined()) {
4611 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
4612 RETURN_IF_EXCEPTION(throwScope, { });
4613 }
4614 JSValue base64CertificateValue;
4615 if (isNullOrUndefined)
4616 base64CertificateValue = jsUndefined();
4617 else {
4618 base64CertificateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "base64Certificate"));
4619 RETURN_IF_EXCEPTION(throwScope, { });
4620 }
4621 if (!base64CertificateValue.isUndefined()) {
4622 result.base64Certificate = convert<IDLDOMString>(lexicalGlobalObject, base64CertificateValue);
4623 RETURN_IF_EXCEPTION(throwScope, { });
4624 }
4625 JSValue fingerprintValue;
4626 if (isNullOrUndefined)
4627 fingerprintValue = jsUndefined();
4628 else {
4629 fingerprintValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fingerprint"));
4630 RETURN_IF_EXCEPTION(throwScope, { });
4631 }
4632 if (!fingerprintValue.isUndefined()) {
4633 result.fingerprint = convert<IDLDOMString>(lexicalGlobalObject, fingerprintValue);
4634 RETURN_IF_EXCEPTION(throwScope, { });
4635 }
4636 JSValue fingerprintAlgorithmValue;
4637 if (isNullOrUndefined)
4638 fingerprintAlgorithmValue = jsUndefined();
4639 else {
4640 fingerprintAlgorithmValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "fingerprintAlgorithm"));
4641 RETURN_IF_EXCEPTION(throwScope, { });
4642 }
4643 if (!fingerprintAlgorithmValue.isUndefined()) {
4644 result.fingerprintAlgorithm = convert<IDLDOMString>(lexicalGlobalObject, fingerprintAlgorithmValue);
4645 RETURN_IF_EXCEPTION(throwScope, { });
4646 }
4647 JSValue issuerCertificateIdValue;
4648 if (isNullOrUndefined)
4649 issuerCertificateIdValue = jsUndefined();
4650 else {
4651 issuerCertificateIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "issuerCertificateId"));
4652 RETURN_IF_EXCEPTION(throwScope, { });
4653 }
4654 if (!issuerCertificateIdValue.isUndefined()) {
4655 result.issuerCertificateId = convert<IDLDOMString>(lexicalGlobalObject, issuerCertificateIdValue);
4656 RETURN_IF_EXCEPTION(throwScope, { });
4657 }
4658 return result;
4659}
4660
4661JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::CertificateStats& dictionary)
4662{
4663 auto& vm = JSC::getVM(&lexicalGlobalObject);
4664 auto throwScope = DECLARE_THROW_SCOPE(vm);
4665
4666 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
4667
4668 if (!IDLDOMString::isNullValue(dictionary.id)) {
4669 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
4670 RETURN_IF_EXCEPTION(throwScope, { });
4671 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
4672 }
4673 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
4674 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
4675 RETURN_IF_EXCEPTION(throwScope, { });
4676 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
4677 }
4678 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
4679 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
4680 RETURN_IF_EXCEPTION(throwScope, { });
4681 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
4682 }
4683 if (!IDLDOMString::isNullValue(dictionary.base64Certificate)) {
4684 auto base64CertificateValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.base64Certificate));
4685 RETURN_IF_EXCEPTION(throwScope, { });
4686 result->putDirect(vm, JSC::Identifier::fromString(vm, "base64Certificate"), base64CertificateValue);
4687 }
4688 if (!IDLDOMString::isNullValue(dictionary.fingerprint)) {
4689 auto fingerprintValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.fingerprint));
4690 RETURN_IF_EXCEPTION(throwScope, { });
4691 result->putDirect(vm, JSC::Identifier::fromString(vm, "fingerprint"), fingerprintValue);
4692 }
4693 if (!IDLDOMString::isNullValue(dictionary.fingerprintAlgorithm)) {
4694 auto fingerprintAlgorithmValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.fingerprintAlgorithm));
4695 RETURN_IF_EXCEPTION(throwScope, { });
4696 result->putDirect(vm, JSC::Identifier::fromString(vm, "fingerprintAlgorithm"), fingerprintAlgorithmValue);
4697 }
4698 if (!IDLDOMString::isNullValue(dictionary.issuerCertificateId)) {
4699 auto issuerCertificateIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.issuerCertificateId));
4700 RETURN_IF_EXCEPTION(throwScope, { });
4701 result->putDirect(vm, JSC::Identifier::fromString(vm, "issuerCertificateId"), issuerCertificateIdValue);
4702 }
4703 return result;
4704}
4705
4706template<> RTCStatsReport::CodecStats convertDictionary<RTCStatsReport::CodecStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
4707{
4708 VM& vm = JSC::getVM(&lexicalGlobalObject);
4709 auto throwScope = DECLARE_THROW_SCOPE(vm);
4710 bool isNullOrUndefined = value.isUndefinedOrNull();
4711 auto* object = isNullOrUndefined ? nullptr : value.getObject();
4712 if (UNLIKELY(!isNullOrUndefined && !object)) {
4713 throwTypeError(&lexicalGlobalObject, throwScope);
4714 return { };
4715 }
4716 RTCStatsReport::CodecStats result;
4717 JSValue idValue;
4718 if (isNullOrUndefined)
4719 idValue = jsUndefined();
4720 else {
4721 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
4722 RETURN_IF_EXCEPTION(throwScope, { });
4723 }
4724 if (!idValue.isUndefined()) {
4725 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
4726 RETURN_IF_EXCEPTION(throwScope, { });
4727 }
4728 JSValue timestampValue;
4729 if (isNullOrUndefined)
4730 timestampValue = jsUndefined();
4731 else {
4732 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
4733 RETURN_IF_EXCEPTION(throwScope, { });
4734 }
4735 if (!timestampValue.isUndefined()) {
4736 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
4737 RETURN_IF_EXCEPTION(throwScope, { });
4738 }
4739 JSValue typeValue;
4740 if (isNullOrUndefined)
4741 typeValue = jsUndefined();
4742 else {
4743 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
4744 RETURN_IF_EXCEPTION(throwScope, { });
4745 }
4746 if (!typeValue.isUndefined()) {
4747 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
4748 RETURN_IF_EXCEPTION(throwScope, { });
4749 }
4750 JSValue channelsValue;
4751 if (isNullOrUndefined)
4752 channelsValue = jsUndefined();
4753 else {
4754 channelsValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "channels"));
4755 RETURN_IF_EXCEPTION(throwScope, { });
4756 }
4757 if (!channelsValue.isUndefined()) {
4758 result.channels = convert<IDLUnsignedLong>(lexicalGlobalObject, channelsValue);
4759 RETURN_IF_EXCEPTION(throwScope, { });
4760 }
4761 JSValue clockRateValue;
4762 if (isNullOrUndefined)
4763 clockRateValue = jsUndefined();
4764 else {
4765 clockRateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "clockRate"));
4766 RETURN_IF_EXCEPTION(throwScope, { });
4767 }
4768 if (!clockRateValue.isUndefined()) {
4769 result.clockRate = convert<IDLUnsignedLong>(lexicalGlobalObject, clockRateValue);
4770 RETURN_IF_EXCEPTION(throwScope, { });
4771 }
4772 JSValue codecTypeValue;
4773 if (isNullOrUndefined)
4774 codecTypeValue = jsUndefined();
4775 else {
4776 codecTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "codecType"));
4777 RETURN_IF_EXCEPTION(throwScope, { });
4778 }
4779 if (!codecTypeValue.isUndefined()) {
4780 result.codecType = convert<IDLEnumeration<RTCStatsReport::CodecType>>(lexicalGlobalObject, codecTypeValue);
4781 RETURN_IF_EXCEPTION(throwScope, { });
4782 }
4783 JSValue mimeTypeValue;
4784 if (isNullOrUndefined)
4785 mimeTypeValue = jsUndefined();
4786 else {
4787 mimeTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "mimeType"));
4788 RETURN_IF_EXCEPTION(throwScope, { });
4789 }
4790 if (!mimeTypeValue.isUndefined()) {
4791 result.mimeType = convert<IDLDOMString>(lexicalGlobalObject, mimeTypeValue);
4792 RETURN_IF_EXCEPTION(throwScope, { });
4793 }
4794 JSValue payloadTypeValue;
4795 if (isNullOrUndefined)
4796 payloadTypeValue = jsUndefined();
4797 else {
4798 payloadTypeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "payloadType"));
4799 RETURN_IF_EXCEPTION(throwScope, { });
4800 }
4801 if (!payloadTypeValue.isUndefined()) {
4802 result.payloadType = convert<IDLUnsignedLong>(lexicalGlobalObject, payloadTypeValue);
4803 RETURN_IF_EXCEPTION(throwScope, { });
4804 }
4805 JSValue sdpFmtpLineValue;
4806 if (isNullOrUndefined)
4807 sdpFmtpLineValue = jsUndefined();
4808 else {
4809 sdpFmtpLineValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "sdpFmtpLine"));
4810 RETURN_IF_EXCEPTION(throwScope, { });
4811 }
4812 if (!sdpFmtpLineValue.isUndefined()) {
4813 result.sdpFmtpLine = convert<IDLDOMString>(lexicalGlobalObject, sdpFmtpLineValue);
4814 RETURN_IF_EXCEPTION(throwScope, { });
4815 }
4816 JSValue transportIdValue;
4817 if (isNullOrUndefined)
4818 transportIdValue = jsUndefined();
4819 else {
4820 transportIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "transportId"));
4821 RETURN_IF_EXCEPTION(throwScope, { });
4822 }
4823 if (!transportIdValue.isUndefined()) {
4824 result.transportId = convert<IDLDOMString>(lexicalGlobalObject, transportIdValue);
4825 RETURN_IF_EXCEPTION(throwScope, { });
4826 }
4827 return result;
4828}
4829
4830JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::CodecStats& dictionary)
4831{
4832 auto& vm = JSC::getVM(&lexicalGlobalObject);
4833 auto throwScope = DECLARE_THROW_SCOPE(vm);
4834
4835 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
4836
4837 if (!IDLDOMString::isNullValue(dictionary.id)) {
4838 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
4839 RETURN_IF_EXCEPTION(throwScope, { });
4840 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
4841 }
4842 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
4843 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
4844 RETURN_IF_EXCEPTION(throwScope, { });
4845 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
4846 }
4847 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
4848 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
4849 RETURN_IF_EXCEPTION(throwScope, { });
4850 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
4851 }
4852 if (!IDLUnsignedLong::isNullValue(dictionary.channels)) {
4853 auto channelsValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.channels));
4854 RETURN_IF_EXCEPTION(throwScope, { });
4855 result->putDirect(vm, JSC::Identifier::fromString(vm, "channels"), channelsValue);
4856 }
4857 if (!IDLUnsignedLong::isNullValue(dictionary.clockRate)) {
4858 auto clockRateValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.clockRate));
4859 RETURN_IF_EXCEPTION(throwScope, { });
4860 result->putDirect(vm, JSC::Identifier::fromString(vm, "clockRate"), clockRateValue);
4861 }
4862 if (!IDLEnumeration<RTCStatsReport::CodecType>::isNullValue(dictionary.codecType)) {
4863 auto codecTypeValue = toJS<IDLEnumeration<RTCStatsReport::CodecType>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::CodecType>::extractValueFromNullable(dictionary.codecType));
4864 RETURN_IF_EXCEPTION(throwScope, { });
4865 result->putDirect(vm, JSC::Identifier::fromString(vm, "codecType"), codecTypeValue);
4866 }
4867 if (!IDLDOMString::isNullValue(dictionary.mimeType)) {
4868 auto mimeTypeValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.mimeType));
4869 RETURN_IF_EXCEPTION(throwScope, { });
4870 result->putDirect(vm, JSC::Identifier::fromString(vm, "mimeType"), mimeTypeValue);
4871 }
4872 if (!IDLUnsignedLong::isNullValue(dictionary.payloadType)) {
4873 auto payloadTypeValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.payloadType));
4874 RETURN_IF_EXCEPTION(throwScope, { });
4875 result->putDirect(vm, JSC::Identifier::fromString(vm, "payloadType"), payloadTypeValue);
4876 }
4877 if (!IDLDOMString::isNullValue(dictionary.sdpFmtpLine)) {
4878 auto sdpFmtpLineValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.sdpFmtpLine));
4879 RETURN_IF_EXCEPTION(throwScope, { });
4880 result->putDirect(vm, JSC::Identifier::fromString(vm, "sdpFmtpLine"), sdpFmtpLineValue);
4881 }
4882 if (!IDLDOMString::isNullValue(dictionary.transportId)) {
4883 auto transportIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.transportId));
4884 RETURN_IF_EXCEPTION(throwScope, { });
4885 result->putDirect(vm, JSC::Identifier::fromString(vm, "transportId"), transportIdValue);
4886 }
4887 return result;
4888}
4889
4890template<> RTCStatsReport::TransportStats convertDictionary<RTCStatsReport::TransportStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
4891{
4892 VM& vm = JSC::getVM(&lexicalGlobalObject);
4893 auto throwScope = DECLARE_THROW_SCOPE(vm);
4894 bool isNullOrUndefined = value.isUndefinedOrNull();
4895 auto* object = isNullOrUndefined ? nullptr : value.getObject();
4896 if (UNLIKELY(!isNullOrUndefined && !object)) {
4897 throwTypeError(&lexicalGlobalObject, throwScope);
4898 return { };
4899 }
4900 RTCStatsReport::TransportStats result;
4901 JSValue idValue;
4902 if (isNullOrUndefined)
4903 idValue = jsUndefined();
4904 else {
4905 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
4906 RETURN_IF_EXCEPTION(throwScope, { });
4907 }
4908 if (!idValue.isUndefined()) {
4909 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
4910 RETURN_IF_EXCEPTION(throwScope, { });
4911 }
4912 JSValue timestampValue;
4913 if (isNullOrUndefined)
4914 timestampValue = jsUndefined();
4915 else {
4916 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
4917 RETURN_IF_EXCEPTION(throwScope, { });
4918 }
4919 if (!timestampValue.isUndefined()) {
4920 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
4921 RETURN_IF_EXCEPTION(throwScope, { });
4922 }
4923 JSValue typeValue;
4924 if (isNullOrUndefined)
4925 typeValue = jsUndefined();
4926 else {
4927 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
4928 RETURN_IF_EXCEPTION(throwScope, { });
4929 }
4930 if (!typeValue.isUndefined()) {
4931 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
4932 RETURN_IF_EXCEPTION(throwScope, { });
4933 }
4934 JSValue bytesReceivedValue;
4935 if (isNullOrUndefined)
4936 bytesReceivedValue = jsUndefined();
4937 else {
4938 bytesReceivedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesReceived"));
4939 RETURN_IF_EXCEPTION(throwScope, { });
4940 }
4941 if (!bytesReceivedValue.isUndefined()) {
4942 result.bytesReceived = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesReceivedValue);
4943 RETURN_IF_EXCEPTION(throwScope, { });
4944 }
4945 JSValue bytesSentValue;
4946 if (isNullOrUndefined)
4947 bytesSentValue = jsUndefined();
4948 else {
4949 bytesSentValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bytesSent"));
4950 RETURN_IF_EXCEPTION(throwScope, { });
4951 }
4952 if (!bytesSentValue.isUndefined()) {
4953 result.bytesSent = convert<IDLUnsignedLongLong>(lexicalGlobalObject, bytesSentValue);
4954 RETURN_IF_EXCEPTION(throwScope, { });
4955 }
4956 JSValue dtlsCipherValue;
4957 if (isNullOrUndefined)
4958 dtlsCipherValue = jsUndefined();
4959 else {
4960 dtlsCipherValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "dtlsCipher"));
4961 RETURN_IF_EXCEPTION(throwScope, { });
4962 }
4963 if (!dtlsCipherValue.isUndefined()) {
4964 result.dtlsCipher = convert<IDLDOMString>(lexicalGlobalObject, dtlsCipherValue);
4965 RETURN_IF_EXCEPTION(throwScope, { });
4966 }
4967 JSValue dtlsStateValue;
4968 if (isNullOrUndefined)
4969 dtlsStateValue = jsUndefined();
4970 else {
4971 dtlsStateValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "dtlsState"));
4972 RETURN_IF_EXCEPTION(throwScope, { });
4973 }
4974 if (!dtlsStateValue.isUndefined()) {
4975 result.dtlsState = convert<IDLDOMString>(lexicalGlobalObject, dtlsStateValue);
4976 RETURN_IF_EXCEPTION(throwScope, { });
4977 } else {
4978 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "dtlsState", "RTCTransportStats", "DOMString");
4979 return { };
4980 }
4981 JSValue localCertificateIdValue;
4982 if (isNullOrUndefined)
4983 localCertificateIdValue = jsUndefined();
4984 else {
4985 localCertificateIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "localCertificateId"));
4986 RETURN_IF_EXCEPTION(throwScope, { });
4987 }
4988 if (!localCertificateIdValue.isUndefined()) {
4989 result.localCertificateId = convert<IDLDOMString>(lexicalGlobalObject, localCertificateIdValue);
4990 RETURN_IF_EXCEPTION(throwScope, { });
4991 }
4992 JSValue remoteCertificateIdValue;
4993 if (isNullOrUndefined)
4994 remoteCertificateIdValue = jsUndefined();
4995 else {
4996 remoteCertificateIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "remoteCertificateId"));
4997 RETURN_IF_EXCEPTION(throwScope, { });
4998 }
4999 if (!remoteCertificateIdValue.isUndefined()) {
5000 result.remoteCertificateId = convert<IDLDOMString>(lexicalGlobalObject, remoteCertificateIdValue);
5001 RETURN_IF_EXCEPTION(throwScope, { });
5002 }
5003 JSValue rtcpTransportStatsIdValue;
5004 if (isNullOrUndefined)
5005 rtcpTransportStatsIdValue = jsUndefined();
5006 else {
5007 rtcpTransportStatsIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "rtcpTransportStatsId"));
5008 RETURN_IF_EXCEPTION(throwScope, { });
5009 }
5010 if (!rtcpTransportStatsIdValue.isUndefined()) {
5011 result.rtcpTransportStatsId = convert<IDLDOMString>(lexicalGlobalObject, rtcpTransportStatsIdValue);
5012 RETURN_IF_EXCEPTION(throwScope, { });
5013 }
5014 JSValue selectedCandidatePairIdValue;
5015 if (isNullOrUndefined)
5016 selectedCandidatePairIdValue = jsUndefined();
5017 else {
5018 selectedCandidatePairIdValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "selectedCandidatePairId"));
5019 RETURN_IF_EXCEPTION(throwScope, { });
5020 }
5021 if (!selectedCandidatePairIdValue.isUndefined()) {
5022 result.selectedCandidatePairId = convert<IDLDOMString>(lexicalGlobalObject, selectedCandidatePairIdValue);
5023 RETURN_IF_EXCEPTION(throwScope, { });
5024 }
5025 JSValue srtpCipherValue;
5026 if (isNullOrUndefined)
5027 srtpCipherValue = jsUndefined();
5028 else {
5029 srtpCipherValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "srtpCipher"));
5030 RETURN_IF_EXCEPTION(throwScope, { });
5031 }
5032 if (!srtpCipherValue.isUndefined()) {
5033 result.srtpCipher = convert<IDLDOMString>(lexicalGlobalObject, srtpCipherValue);
5034 RETURN_IF_EXCEPTION(throwScope, { });
5035 }
5036 JSValue tlsVersionValue;
5037 if (isNullOrUndefined)
5038 tlsVersionValue = jsUndefined();
5039 else {
5040 tlsVersionValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "tlsVersion"));
5041 RETURN_IF_EXCEPTION(throwScope, { });
5042 }
5043 if (!tlsVersionValue.isUndefined()) {
5044 result.tlsVersion = convert<IDLDOMString>(lexicalGlobalObject, tlsVersionValue);
5045 RETURN_IF_EXCEPTION(throwScope, { });
5046 }
5047 return result;
5048}
5049
5050JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::TransportStats& dictionary)
5051{
5052 auto& vm = JSC::getVM(&lexicalGlobalObject);
5053 auto throwScope = DECLARE_THROW_SCOPE(vm);
5054
5055 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
5056
5057 if (!IDLDOMString::isNullValue(dictionary.id)) {
5058 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
5059 RETURN_IF_EXCEPTION(throwScope, { });
5060 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
5061 }
5062 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
5063 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
5064 RETURN_IF_EXCEPTION(throwScope, { });
5065 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
5066 }
5067 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
5068 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
5069 RETURN_IF_EXCEPTION(throwScope, { });
5070 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
5071 }
5072 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesReceived)) {
5073 auto bytesReceivedValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesReceived));
5074 RETURN_IF_EXCEPTION(throwScope, { });
5075 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesReceived"), bytesReceivedValue);
5076 }
5077 if (!IDLUnsignedLongLong::isNullValue(dictionary.bytesSent)) {
5078 auto bytesSentValue = toJS<IDLUnsignedLongLong>(lexicalGlobalObject, throwScope, IDLUnsignedLongLong::extractValueFromNullable(dictionary.bytesSent));
5079 RETURN_IF_EXCEPTION(throwScope, { });
5080 result->putDirect(vm, JSC::Identifier::fromString(vm, "bytesSent"), bytesSentValue);
5081 }
5082 if (!IDLDOMString::isNullValue(dictionary.dtlsCipher)) {
5083 auto dtlsCipherValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.dtlsCipher));
5084 RETURN_IF_EXCEPTION(throwScope, { });
5085 result->putDirect(vm, JSC::Identifier::fromString(vm, "dtlsCipher"), dtlsCipherValue);
5086 }
5087 auto dtlsStateValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.dtlsState);
5088 RETURN_IF_EXCEPTION(throwScope, { });
5089 result->putDirect(vm, JSC::Identifier::fromString(vm, "dtlsState"), dtlsStateValue);
5090 if (!IDLDOMString::isNullValue(dictionary.localCertificateId)) {
5091 auto localCertificateIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.localCertificateId));
5092 RETURN_IF_EXCEPTION(throwScope, { });
5093 result->putDirect(vm, JSC::Identifier::fromString(vm, "localCertificateId"), localCertificateIdValue);
5094 }
5095 if (!IDLDOMString::isNullValue(dictionary.remoteCertificateId)) {
5096 auto remoteCertificateIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.remoteCertificateId));
5097 RETURN_IF_EXCEPTION(throwScope, { });
5098 result->putDirect(vm, JSC::Identifier::fromString(vm, "remoteCertificateId"), remoteCertificateIdValue);
5099 }
5100 if (!IDLDOMString::isNullValue(dictionary.rtcpTransportStatsId)) {
5101 auto rtcpTransportStatsIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.rtcpTransportStatsId));
5102 RETURN_IF_EXCEPTION(throwScope, { });
5103 result->putDirect(vm, JSC::Identifier::fromString(vm, "rtcpTransportStatsId"), rtcpTransportStatsIdValue);
5104 }
5105 if (!IDLDOMString::isNullValue(dictionary.selectedCandidatePairId)) {
5106 auto selectedCandidatePairIdValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.selectedCandidatePairId));
5107 RETURN_IF_EXCEPTION(throwScope, { });
5108 result->putDirect(vm, JSC::Identifier::fromString(vm, "selectedCandidatePairId"), selectedCandidatePairIdValue);
5109 }
5110 if (!IDLDOMString::isNullValue(dictionary.srtpCipher)) {
5111 auto srtpCipherValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.srtpCipher));
5112 RETURN_IF_EXCEPTION(throwScope, { });
5113 result->putDirect(vm, JSC::Identifier::fromString(vm, "srtpCipher"), srtpCipherValue);
5114 }
5115 if (!IDLDOMString::isNullValue(dictionary.tlsVersion)) {
5116 auto tlsVersionValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.tlsVersion));
5117 RETURN_IF_EXCEPTION(throwScope, { });
5118 result->putDirect(vm, JSC::Identifier::fromString(vm, "tlsVersion"), tlsVersionValue);
5119 }
5120 return result;
5121}
5122
5123template<> RTCStatsReport::PeerConnectionStats convertDictionary<RTCStatsReport::PeerConnectionStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
5124{
5125 VM& vm = JSC::getVM(&lexicalGlobalObject);
5126 auto throwScope = DECLARE_THROW_SCOPE(vm);
5127 bool isNullOrUndefined = value.isUndefinedOrNull();
5128 auto* object = isNullOrUndefined ? nullptr : value.getObject();
5129 if (UNLIKELY(!isNullOrUndefined && !object)) {
5130 throwTypeError(&lexicalGlobalObject, throwScope);
5131 return { };
5132 }
5133 RTCStatsReport::PeerConnectionStats result;
5134 JSValue idValue;
5135 if (isNullOrUndefined)
5136 idValue = jsUndefined();
5137 else {
5138 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
5139 RETURN_IF_EXCEPTION(throwScope, { });
5140 }
5141 if (!idValue.isUndefined()) {
5142 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
5143 RETURN_IF_EXCEPTION(throwScope, { });
5144 }
5145 JSValue timestampValue;
5146 if (isNullOrUndefined)
5147 timestampValue = jsUndefined();
5148 else {
5149 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
5150 RETURN_IF_EXCEPTION(throwScope, { });
5151 }
5152 if (!timestampValue.isUndefined()) {
5153 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
5154 RETURN_IF_EXCEPTION(throwScope, { });
5155 }
5156 JSValue typeValue;
5157 if (isNullOrUndefined)
5158 typeValue = jsUndefined();
5159 else {
5160 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
5161 RETURN_IF_EXCEPTION(throwScope, { });
5162 }
5163 if (!typeValue.isUndefined()) {
5164 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
5165 RETURN_IF_EXCEPTION(throwScope, { });
5166 }
5167 JSValue dataChannelsClosedValue;
5168 if (isNullOrUndefined)
5169 dataChannelsClosedValue = jsUndefined();
5170 else {
5171 dataChannelsClosedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "dataChannelsClosed"));
5172 RETURN_IF_EXCEPTION(throwScope, { });
5173 }
5174 if (!dataChannelsClosedValue.isUndefined()) {
5175 result.dataChannelsClosed = convert<IDLUnsignedLong>(lexicalGlobalObject, dataChannelsClosedValue);
5176 RETURN_IF_EXCEPTION(throwScope, { });
5177 }
5178 JSValue dataChannelsOpenedValue;
5179 if (isNullOrUndefined)
5180 dataChannelsOpenedValue = jsUndefined();
5181 else {
5182 dataChannelsOpenedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "dataChannelsOpened"));
5183 RETURN_IF_EXCEPTION(throwScope, { });
5184 }
5185 if (!dataChannelsOpenedValue.isUndefined()) {
5186 result.dataChannelsOpened = convert<IDLUnsignedLong>(lexicalGlobalObject, dataChannelsOpenedValue);
5187 RETURN_IF_EXCEPTION(throwScope, { });
5188 }
5189 return result;
5190}
5191
5192JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::PeerConnectionStats& dictionary)
5193{
5194 auto& vm = JSC::getVM(&lexicalGlobalObject);
5195 auto throwScope = DECLARE_THROW_SCOPE(vm);
5196
5197 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
5198
5199 if (!IDLDOMString::isNullValue(dictionary.id)) {
5200 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
5201 RETURN_IF_EXCEPTION(throwScope, { });
5202 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
5203 }
5204 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
5205 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
5206 RETURN_IF_EXCEPTION(throwScope, { });
5207 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
5208 }
5209 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
5210 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
5211 RETURN_IF_EXCEPTION(throwScope, { });
5212 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
5213 }
5214 if (!IDLUnsignedLong::isNullValue(dictionary.dataChannelsClosed)) {
5215 auto dataChannelsClosedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.dataChannelsClosed));
5216 RETURN_IF_EXCEPTION(throwScope, { });
5217 result->putDirect(vm, JSC::Identifier::fromString(vm, "dataChannelsClosed"), dataChannelsClosedValue);
5218 }
5219 if (!IDLUnsignedLong::isNullValue(dictionary.dataChannelsOpened)) {
5220 auto dataChannelsOpenedValue = toJS<IDLUnsignedLong>(lexicalGlobalObject, throwScope, IDLUnsignedLong::extractValueFromNullable(dictionary.dataChannelsOpened));
5221 RETURN_IF_EXCEPTION(throwScope, { });
5222 result->putDirect(vm, JSC::Identifier::fromString(vm, "dataChannelsOpened"), dataChannelsOpenedValue);
5223 }
5224 return result;
5225}
5226
5227template<> RTCStatsReport::MediaSourceStats convertDictionary<RTCStatsReport::MediaSourceStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
5228{
5229 VM& vm = JSC::getVM(&lexicalGlobalObject);
5230 auto throwScope = DECLARE_THROW_SCOPE(vm);
5231 bool isNullOrUndefined = value.isUndefinedOrNull();
5232 auto* object = isNullOrUndefined ? nullptr : value.getObject();
5233 if (UNLIKELY(!isNullOrUndefined && !object)) {
5234 throwTypeError(&lexicalGlobalObject, throwScope);
5235 return { };
5236 }
5237 RTCStatsReport::MediaSourceStats result;
5238 JSValue idValue;
5239 if (isNullOrUndefined)
5240 idValue = jsUndefined();
5241 else {
5242 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
5243 RETURN_IF_EXCEPTION(throwScope, { });
5244 }
5245 if (!idValue.isUndefined()) {
5246 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
5247 RETURN_IF_EXCEPTION(throwScope, { });
5248 }
5249 JSValue timestampValue;
5250 if (isNullOrUndefined)
5251 timestampValue = jsUndefined();
5252 else {
5253 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
5254 RETURN_IF_EXCEPTION(throwScope, { });
5255 }
5256 if (!timestampValue.isUndefined()) {
5257 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
5258 RETURN_IF_EXCEPTION(throwScope, { });
5259 }
5260 JSValue typeValue;
5261 if (isNullOrUndefined)
5262 typeValue = jsUndefined();
5263 else {
5264 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
5265 RETURN_IF_EXCEPTION(throwScope, { });
5266 }
5267 if (!typeValue.isUndefined()) {
5268 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
5269 RETURN_IF_EXCEPTION(throwScope, { });
5270 }
5271 JSValue kindValue;
5272 if (isNullOrUndefined)
5273 kindValue = jsUndefined();
5274 else {
5275 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
5276 RETURN_IF_EXCEPTION(throwScope, { });
5277 }
5278 if (!kindValue.isUndefined()) {
5279 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
5280 RETURN_IF_EXCEPTION(throwScope, { });
5281 } else {
5282 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCMediaSourceStats", "DOMString");
5283 return { };
5284 }
5285 JSValue relayedSourceValue;
5286 if (isNullOrUndefined)
5287 relayedSourceValue = jsUndefined();
5288 else {
5289 relayedSourceValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "relayedSource"));
5290 RETURN_IF_EXCEPTION(throwScope, { });
5291 }
5292 if (!relayedSourceValue.isUndefined()) {
5293 result.relayedSource = convert<IDLBoolean>(lexicalGlobalObject, relayedSourceValue);
5294 RETURN_IF_EXCEPTION(throwScope, { });
5295 }
5296 JSValue trackIdentifierValue;
5297 if (isNullOrUndefined)
5298 trackIdentifierValue = jsUndefined();
5299 else {
5300 trackIdentifierValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackIdentifier"));
5301 RETURN_IF_EXCEPTION(throwScope, { });
5302 }
5303 if (!trackIdentifierValue.isUndefined()) {
5304 result.trackIdentifier = convert<IDLDOMString>(lexicalGlobalObject, trackIdentifierValue);
5305 RETURN_IF_EXCEPTION(throwScope, { });
5306 } else {
5307 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "trackIdentifier", "RTCMediaSourceStats", "DOMString");
5308 return { };
5309 }
5310 return result;
5311}
5312
5313JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const RTCStatsReport::MediaSourceStats& dictionary)
5314{
5315 auto& vm = JSC::getVM(&lexicalGlobalObject);
5316 auto throwScope = DECLARE_THROW_SCOPE(vm);
5317
5318 auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype());
5319
5320 if (!IDLDOMString::isNullValue(dictionary.id)) {
5321 auto idValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, IDLDOMString::extractValueFromNullable(dictionary.id));
5322 RETURN_IF_EXCEPTION(throwScope, { });
5323 result->putDirect(vm, JSC::Identifier::fromString(vm, "id"), idValue);
5324 }
5325 if (!IDLDouble::isNullValue(dictionary.timestamp)) {
5326 auto timestampValue = toJS<IDLDouble>(lexicalGlobalObject, throwScope, IDLDouble::extractValueFromNullable(dictionary.timestamp));
5327 RETURN_IF_EXCEPTION(throwScope, { });
5328 result->putDirect(vm, JSC::Identifier::fromString(vm, "timestamp"), timestampValue);
5329 }
5330 if (!IDLEnumeration<RTCStatsReport::Type>::isNullValue(dictionary.type)) {
5331 auto typeValue = toJS<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, throwScope, IDLEnumeration<RTCStatsReport::Type>::extractValueFromNullable(dictionary.type));
5332 RETURN_IF_EXCEPTION(throwScope, { });
5333 result->putDirect(vm, JSC::Identifier::fromString(vm, "type"), typeValue);
5334 }
5335 auto kindValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.kind);
5336 RETURN_IF_EXCEPTION(throwScope, { });
5337 result->putDirect(vm, JSC::Identifier::fromString(vm, "kind"), kindValue);
5338 if (!IDLBoolean::isNullValue(dictionary.relayedSource)) {
5339 auto relayedSourceValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, IDLBoolean::extractValueFromNullable(dictionary.relayedSource));
5340 RETURN_IF_EXCEPTION(throwScope, { });
5341 result->putDirect(vm, JSC::Identifier::fromString(vm, "relayedSource"), relayedSourceValue);
5342 }
5343 auto trackIdentifierValue = toJS<IDLDOMString>(lexicalGlobalObject, throwScope, dictionary.trackIdentifier);
5344 RETURN_IF_EXCEPTION(throwScope, { });
5345 result->putDirect(vm, JSC::Identifier::fromString(vm, "trackIdentifier"), trackIdentifierValue);
5346 return result;
5347}
5348
5349template<> RTCStatsReport::AudioSourceStats convertDictionary<RTCStatsReport::AudioSourceStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
5350{
5351 VM& vm = JSC::getVM(&lexicalGlobalObject);
5352 auto throwScope = DECLARE_THROW_SCOPE(vm);
5353 bool isNullOrUndefined = value.isUndefinedOrNull();
5354 auto* object = isNullOrUndefined ? nullptr : value.getObject();
5355 if (UNLIKELY(!isNullOrUndefined && !object)) {
5356 throwTypeError(&lexicalGlobalObject, throwScope);
5357 return { };
5358 }
5359 RTCStatsReport::AudioSourceStats result;
5360 JSValue idValue;
5361 if (isNullOrUndefined)
5362 idValue = jsUndefined();
5363 else {
5364 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
5365 RETURN_IF_EXCEPTION(throwScope, { });
5366 }
5367 if (!idValue.isUndefined()) {
5368 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
5369 RETURN_IF_EXCEPTION(throwScope, { });
5370 }
5371 JSValue timestampValue;
5372 if (isNullOrUndefined)
5373 timestampValue = jsUndefined();
5374 else {
5375 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
5376 RETURN_IF_EXCEPTION(throwScope, { });
5377 }
5378 if (!timestampValue.isUndefined()) {
5379 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
5380 RETURN_IF_EXCEPTION(throwScope, { });
5381 }
5382 JSValue typeValue;
5383 if (isNullOrUndefined)
5384 typeValue = jsUndefined();
5385 else {
5386 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
5387 RETURN_IF_EXCEPTION(throwScope, { });
5388 }
5389 if (!typeValue.isUndefined()) {
5390 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
5391 RETURN_IF_EXCEPTION(throwScope, { });
5392 }
5393 JSValue kindValue;
5394 if (isNullOrUndefined)
5395 kindValue = jsUndefined();
5396 else {
5397 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
5398 RETURN_IF_EXCEPTION(throwScope, { });
5399 }
5400 if (!kindValue.isUndefined()) {
5401 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
5402 RETURN_IF_EXCEPTION(throwScope, { });
5403 } else {
5404 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCAudioSourceStats", "DOMString");
5405 return { };
5406 }
5407 JSValue relayedSourceValue;
5408 if (isNullOrUndefined)
5409 relayedSourceValue = jsUndefined();
5410 else {
5411 relayedSourceValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "relayedSource"));
5412 RETURN_IF_EXCEPTION(throwScope, { });
5413 }
5414 if (!relayedSourceValue.isUndefined()) {
5415 result.relayedSource = convert<IDLBoolean>(lexicalGlobalObject, relayedSourceValue);
5416 RETURN_IF_EXCEPTION(throwScope, { });
5417 }
5418 JSValue trackIdentifierValue;
5419 if (isNullOrUndefined)
5420 trackIdentifierValue = jsUndefined();
5421 else {
5422 trackIdentifierValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackIdentifier"));
5423 RETURN_IF_EXCEPTION(throwScope, { });
5424 }
5425 if (!trackIdentifierValue.isUndefined()) {
5426 result.trackIdentifier = convert<IDLDOMString>(lexicalGlobalObject, trackIdentifierValue);
5427 RETURN_IF_EXCEPTION(throwScope, { });
5428 } else {
5429 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "trackIdentifier", "RTCAudioSourceStats", "DOMString");
5430 return { };
5431 }
5432 JSValue audioLevelValue;
5433 if (isNullOrUndefined)
5434 audioLevelValue = jsUndefined();
5435 else {
5436 audioLevelValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "audioLevel"));
5437 RETURN_IF_EXCEPTION(throwScope, { });
5438 }
5439 if (!audioLevelValue.isUndefined()) {
5440 result.audioLevel = convert<IDLDouble>(lexicalGlobalObject, audioLevelValue);
5441 RETURN_IF_EXCEPTION(throwScope, { });
5442 }
5443 JSValue echoReturnLossValue;
5444 if (isNullOrUndefined)
5445 echoReturnLossValue = jsUndefined();
5446 else {
5447 echoReturnLossValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "echoReturnLoss"));
5448 RETURN_IF_EXCEPTION(throwScope, { });
5449 }
5450 if (!echoReturnLossValue.isUndefined()) {
5451 result.echoReturnLoss = convert<IDLDouble>(lexicalGlobalObject, echoReturnLossValue);
5452 RETURN_IF_EXCEPTION(throwScope, { });
5453 }
5454 JSValue echoReturnLossEnhancementValue;
5455 if (isNullOrUndefined)
5456 echoReturnLossEnhancementValue = jsUndefined();
5457 else {
5458 echoReturnLossEnhancementValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "echoReturnLossEnhancement"));
5459 RETURN_IF_EXCEPTION(throwScope, { });
5460 }
5461 if (!echoReturnLossEnhancementValue.isUndefined()) {
5462 result.echoReturnLossEnhancement = convert<IDLDouble>(lexicalGlobalObject, echoReturnLossEnhancementValue);
5463 RETURN_IF_EXCEPTION(throwScope, { });
5464 }
5465 JSValue totalAudioEnergyValue;
5466 if (isNullOrUndefined)
5467 totalAudioEnergyValue = jsUndefined();
5468 else {
5469 totalAudioEnergyValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalAudioEnergy"));
5470 RETURN_IF_EXCEPTION(throwScope, { });
5471 }
5472 if (!totalAudioEnergyValue.isUndefined()) {
5473 result.totalAudioEnergy = convert<IDLDouble>(lexicalGlobalObject, totalAudioEnergyValue);
5474 RETURN_IF_EXCEPTION(throwScope, { });
5475 }
5476 JSValue totalSamplesDurationValue;
5477 if (isNullOrUndefined)
5478 totalSamplesDurationValue = jsUndefined();
5479 else {
5480 totalSamplesDurationValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "totalSamplesDuration"));
5481 RETURN_IF_EXCEPTION(throwScope, { });
5482 }
5483 if (!totalSamplesDurationValue.isUndefined()) {
5484 result.totalSamplesDuration = convert<IDLDouble>(lexicalGlobalObject, totalSamplesDurationValue);
5485 RETURN_IF_EXCEPTION(throwScope, { });
5486 }
5487 return result;
5488}
5489
5490template<> RTCStatsReport::VideoSourceStats convertDictionary<RTCStatsReport::VideoSourceStats>(JSGlobalObject& lexicalGlobalObject, JSValue value)
5491{
5492 VM& vm = JSC::getVM(&lexicalGlobalObject);
5493 auto throwScope = DECLARE_THROW_SCOPE(vm);
5494 bool isNullOrUndefined = value.isUndefinedOrNull();
5495 auto* object = isNullOrUndefined ? nullptr : value.getObject();
5496 if (UNLIKELY(!isNullOrUndefined && !object)) {
5497 throwTypeError(&lexicalGlobalObject, throwScope);
5498 return { };
5499 }
5500 RTCStatsReport::VideoSourceStats result;
5501 JSValue idValue;
5502 if (isNullOrUndefined)
5503 idValue = jsUndefined();
5504 else {
5505 idValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "id"));
5506 RETURN_IF_EXCEPTION(throwScope, { });
5507 }
5508 if (!idValue.isUndefined()) {
5509 result.id = convert<IDLDOMString>(lexicalGlobalObject, idValue);
5510 RETURN_IF_EXCEPTION(throwScope, { });
5511 }
5512 JSValue timestampValue;
5513 if (isNullOrUndefined)
5514 timestampValue = jsUndefined();
5515 else {
5516 timestampValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "timestamp"));
5517 RETURN_IF_EXCEPTION(throwScope, { });
5518 }
5519 if (!timestampValue.isUndefined()) {
5520 result.timestamp = convert<IDLDouble>(lexicalGlobalObject, timestampValue);
5521 RETURN_IF_EXCEPTION(throwScope, { });
5522 }
5523 JSValue typeValue;
5524 if (isNullOrUndefined)
5525 typeValue = jsUndefined();
5526 else {
5527 typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type"));
5528 RETURN_IF_EXCEPTION(throwScope, { });
5529 }
5530 if (!typeValue.isUndefined()) {
5531 result.type = convert<IDLEnumeration<RTCStatsReport::Type>>(lexicalGlobalObject, typeValue);
5532 RETURN_IF_EXCEPTION(throwScope, { });
5533 }
5534 JSValue kindValue;
5535 if (isNullOrUndefined)
5536 kindValue = jsUndefined();
5537 else {
5538 kindValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "kind"));
5539 RETURN_IF_EXCEPTION(throwScope, { });
5540 }
5541 if (!kindValue.isUndefined()) {
5542 result.kind = convert<IDLDOMString>(lexicalGlobalObject, kindValue);
5543 RETURN_IF_EXCEPTION(throwScope, { });
5544 } else {
5545 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "kind", "RTCVideoSourceStats", "DOMString");
5546 return { };
5547 }
5548 JSValue relayedSourceValue;
5549 if (isNullOrUndefined)
5550 relayedSourceValue = jsUndefined();
5551 else {
5552 relayedSourceValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "relayedSource"));
5553 RETURN_IF_EXCEPTION(throwScope, { });
5554 }
5555 if (!relayedSourceValue.isUndefined()) {
5556 result.relayedSource = convert<IDLBoolean>(lexicalGlobalObject, relayedSourceValue);
5557 RETURN_IF_EXCEPTION(throwScope, { });
5558 }
5559 JSValue trackIdentifierValue;
5560 if (isNullOrUndefined)
5561 trackIdentifierValue = jsUndefined();
5562 else {
5563 trackIdentifierValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "trackIdentifier"));
5564 RETURN_IF_EXCEPTION(throwScope, { });
5565 }
5566 if (!trackIdentifierValue.isUndefined()) {
5567 result.trackIdentifier = convert<IDLDOMString>(lexicalGlobalObject, trackIdentifierValue);
5568 RETURN_IF_EXCEPTION(throwScope, { });
5569 } else {
5570 throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, "trackIdentifier", "RTCVideoSourceStats", "DOMString");
5571 return { };
5572 }
5573 JSValue bitDepthValue;
5574 if (isNullOrUndefined)
5575 bitDepthValue = jsUndefined();
5576 else {
5577 bitDepthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "bitDepth"));
5578 RETURN_IF_EXCEPTION(throwScope, { });
5579 }
5580 if (!bitDepthValue.isUndefined()) {
5581 result.bitDepth = convert<IDLUnsignedLong>(lexicalGlobalObject, bitDepthValue);
5582 RETURN_IF_EXCEPTION(throwScope, { });
5583 }
5584 JSValue framesValue;
5585 if (isNullOrUndefined)
5586 framesValue = jsUndefined();
5587 else {
5588 framesValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "frames"));
5589 RETURN_IF_EXCEPTION(throwScope, { });
5590 }
5591 if (!framesValue.isUndefined()) {
5592 result.frames = convert<IDLUnsignedLong>(lexicalGlobalObject, framesValue);
5593 RETURN_IF_EXCEPTION(throwScope, { });
5594 }
5595 JSValue framesPerSecondValue;
5596 if (isNullOrUndefined)
5597 framesPerSecondValue = jsUndefined();
5598 else {
5599 framesPerSecondValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "framesPerSecond"));
5600 RETURN_IF_EXCEPTION(throwScope, { });
5601 }
5602 if (!framesPerSecondValue.isUndefined()) {
5603 result.framesPerSecond = convert<IDLDouble>(lexicalGlobalObject, framesPerSecondValue);
5604 RETURN_IF_EXCEPTION(throwScope, { });
5605 }
5606 JSValue heightValue;
5607 if (isNullOrUndefined)
5608 heightValue = jsUndefined();
5609 else {
5610 heightValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "height"));
5611 RETURN_IF_EXCEPTION(throwScope, { });
5612 }
5613 if (!heightValue.isUndefined()) {
5614 result.height = convert<IDLUnsignedLong>(lexicalGlobalObject, heightValue);
5615 RETURN_IF_EXCEPTION(throwScope, { });
5616 }
5617 JSValue widthValue;
5618 if (isNullOrUndefined)
5619 widthValue = jsUndefined();
5620 else {
5621 widthValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "width"));
5622 RETURN_IF_EXCEPTION(throwScope, { });
5623 }
5624 if (!widthValue.isUndefined()) {
5625 result.width = convert<IDLUnsignedLong>(lexicalGlobalObject, widthValue);
5626 RETURN_IF_EXCEPTION(throwScope, { });
5627 }
5628 return result;
5629}
5630
5631// Functions
5632
5633static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_get);
5634static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_has);
5635static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_entries);
5636static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_keys);
5637static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_values);
5638static JSC_DECLARE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_forEach);
5639
5640// Attributes
5641
5642static JSC_DECLARE_CUSTOM_GETTER(jsRTCStatsReportConstructor);
5643static JSC_DECLARE_CUSTOM_GETTER(jsRTCStatsReport_size);
5644
5645class JSRTCStatsReportPrototype final : public JSC::JSNonFinalObject {
5646public:
5647 using Base = JSC::JSNonFinalObject;
5648 static JSRTCStatsReportPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
5649 {
5650 JSRTCStatsReportPrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCStatsReportPrototype>(vm.heap)) JSRTCStatsReportPrototype(vm, globalObject, structure);
5651 ptr->finishCreation(vm);
5652 return ptr;
5653 }
5654
5655 DECLARE_INFO;
5656 template<typename CellType, JSC::SubspaceAccess>
5657 static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
5658 {
5659 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRTCStatsReportPrototype, Base);
5660 return &vm.plainObjectSpace;
5661 }
5662 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
5663 {
5664 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
5665 }
5666
5667private:
5668 JSRTCStatsReportPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
5669 : JSC::JSNonFinalObject(vm, structure)
5670 {
5671 }
5672
5673 void finishCreation(JSC::VM&);
5674public:
5675 static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::HasStaticPropertyTable;
5676};
5677STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSRTCStatsReportPrototype, JSRTCStatsReportPrototype::Base);
5678
5679using JSRTCStatsReportDOMConstructor = JSDOMConstructorNotConstructable<JSRTCStatsReport>;
5680
5681template<> const unsigned JSRTCStatsReportDOMConstructor::StructureFlags = Base::StructureFlags;
5682template<> const ClassInfo JSRTCStatsReportDOMConstructor::s_info = { "RTCStatsReport", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCStatsReportDOMConstructor) };
5683
5684template<> JSValue JSRTCStatsReportDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
5685{
5686 UNUSED_PARAM(vm);
5687 return globalObject.functionPrototype();
5688}
5689
5690template<> void JSRTCStatsReportDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
5691{
5692 putDirect(vm, vm.propertyNames->prototype, JSRTCStatsReport::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
5693 putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, "RTCStatsReport"_s), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
5694 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
5695}
5696
5697/* Hash table for Prototype */
5698
5699static const struct CompactHashIndex JSRTCStatsReportPrototypeTableIndex[18] = {
5700 { 1, 17 },
5701 { -1, -1 },
5702 { 5, -1 },
5703 { -1, -1 },
5704 { -1, -1 },
5705 { 2, -1 },
5706 { -1, -1 },
5707 { 7, -1 },
5708 { -1, -1 },
5709 { 0, 16 },
5710 { -1, -1 },
5711 { -1, -1 },
5712 { -1, -1 },
5713 { -1, -1 },
5714 { 3, -1 },
5715 { -1, -1 },
5716 { 4, -1 },
5717 { 6, -1 },
5718};
5719
5720
5721static const HashTableValue JSRTCStatsReportPrototypeTableValues[] =
5722{
5723 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReportConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
5724 { "size", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCStatsReport_size), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(nullptr) } },
5725 { "get", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function, NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_get), (intptr_t) (1) } },
5726 { "has", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function, NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_has), (intptr_t) (1) } },
5727 { "entries", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function, NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_entries), (intptr_t) (0) } },
5728 { "keys", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function, NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_keys), (intptr_t) (0) } },
5729 { "values", JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::Function, NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_values), (intptr_t) (0) } },
5730 { "forEach", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsRTCStatsReportPrototypeFunction_forEach), (intptr_t) (1) } },
5731};
5732
5733static const HashTable JSRTCStatsReportPrototypeTable = { 8, 15, true, JSRTCStatsReport::info(), JSRTCStatsReportPrototypeTableValues, JSRTCStatsReportPrototypeTableIndex };
5734const ClassInfo JSRTCStatsReportPrototype::s_info = { "RTCStatsReport", &Base::s_info, &JSRTCStatsReportPrototypeTable, nullptr, CREATE_METHOD_TABLE(JSRTCStatsReportPrototype) };
5735
5736void JSRTCStatsReportPrototype::finishCreation(VM& vm)
5737{
5738 Base::finishCreation(vm);
5739 reifyStaticProperties(vm, JSRTCStatsReport::info(), JSRTCStatsReportPrototypeTableValues, *this);
5740 auto& entries = vm.propertyNames->builtinNames().entriesPublicName();
5741 reifyStaticProperty(vm, nullptr, entries, *info()->staticPropHashTable->entry(entries), *this);
5742 putDirectWithoutTransition(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, entries), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
5743 JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
5744}
5745
5746const ClassInfo JSRTCStatsReport::s_info = { "RTCStatsReport", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCStatsReport) };
5747
5748JSRTCStatsReport::JSRTCStatsReport(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCStatsReport>&& impl)
5749 : JSDOMWrapper<RTCStatsReport>(structure, globalObject, WTFMove(impl))
5750{
5751}
5752
5753void JSRTCStatsReport::finishCreation(VM& vm)
5754{
5755 Base::finishCreation(vm);
5756 ASSERT(inherits(vm, info()));
5757
5758 static_assert(!std::is_base_of<ActiveDOMObject, RTCStatsReport>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
5759
5760}
5761
5762JSObject* JSRTCStatsReport::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
5763{
5764 return JSRTCStatsReportPrototype::create(vm, &globalObject, JSRTCStatsReportPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
5765}
5766
5767JSObject* JSRTCStatsReport::prototype(VM& vm, JSDOMGlobalObject& globalObject)
5768{
5769 return getDOMPrototype<JSRTCStatsReport>(vm, globalObject);
5770}
5771
5772JSValue JSRTCStatsReport::getConstructor(VM& vm, const JSGlobalObject* globalObject)
5773{
5774 return getDOMConstructor<JSRTCStatsReportDOMConstructor, DOMConstructorID::RTCStatsReport>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
5775}
5776
5777void JSRTCStatsReport::destroy(JSC::JSCell* cell)
5778{
5779 JSRTCStatsReport* thisObject = static_cast<JSRTCStatsReport*>(cell);
5780 thisObject->JSRTCStatsReport::~JSRTCStatsReport();
5781}
5782
5783JSC_DEFINE_CUSTOM_GETTER(jsRTCStatsReportConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
5784{
5785 VM& vm = JSC::getVM(lexicalGlobalObject);
5786 auto throwScope = DECLARE_THROW_SCOPE(vm);
5787 auto* prototype = jsDynamicCast<JSRTCStatsReportPrototype*>(vm, JSValue::decode(thisValue));
5788 if (UNLIKELY(!prototype))
5789 return throwVMTypeError(lexicalGlobalObject, throwScope);
5790 return JSValue::encode(JSRTCStatsReport::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject()));
5791}
5792
5793static inline JSValue jsRTCStatsReport_sizeGetter(JSGlobalObject& lexicalGlobalObject, JSRTCStatsReport& thisObject)
5794{
5795 auto& vm = JSC::getVM(&lexicalGlobalObject);
5796 auto throwScope = DECLARE_THROW_SCOPE(vm);
5797 RELEASE_AND_RETURN(throwScope, (toJS<IDLAny>(lexicalGlobalObject, throwScope, forwardSizeToMapLike(lexicalGlobalObject, thisObject))));
5798}
5799
5800JSC_DEFINE_CUSTOM_GETTER(jsRTCStatsReport_size, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
5801{
5802 return IDLAttribute<JSRTCStatsReport>::get<jsRTCStatsReport_sizeGetter>(*lexicalGlobalObject, thisValue, attributeName);
5803}
5804
5805static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_getBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5806{
5807 auto& vm = JSC::getVM(lexicalGlobalObject);
5808 auto throwScope = DECLARE_THROW_SCOPE(vm);
5809 UNUSED_PARAM(throwScope);
5810 UNUSED_PARAM(callFrame);
5811 if (UNLIKELY(callFrame->argumentCount() < 1))
5812 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
5813 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
5814 auto key = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
5815 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
5816 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardGetToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(key)))));
5817}
5818
5819JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_get, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5820{
5821 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_getBody>(*lexicalGlobalObject, *callFrame, "get");
5822}
5823
5824static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_hasBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5825{
5826 auto& vm = JSC::getVM(lexicalGlobalObject);
5827 auto throwScope = DECLARE_THROW_SCOPE(vm);
5828 UNUSED_PARAM(throwScope);
5829 UNUSED_PARAM(callFrame);
5830 if (UNLIKELY(callFrame->argumentCount() < 1))
5831 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
5832 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
5833 auto key = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
5834 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
5835 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardHasToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(key)))));
5836}
5837
5838JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_has, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5839{
5840 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_hasBody>(*lexicalGlobalObject, *callFrame, "has");
5841}
5842
5843static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_entriesBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5844{
5845 auto& vm = JSC::getVM(lexicalGlobalObject);
5846 auto throwScope = DECLARE_THROW_SCOPE(vm);
5847 UNUSED_PARAM(throwScope);
5848 UNUSED_PARAM(callFrame);
5849 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardEntriesToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
5850}
5851
5852JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_entries, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5853{
5854 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_entriesBody>(*lexicalGlobalObject, *callFrame, "entries");
5855}
5856
5857static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_keysBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5858{
5859 auto& vm = JSC::getVM(lexicalGlobalObject);
5860 auto throwScope = DECLARE_THROW_SCOPE(vm);
5861 UNUSED_PARAM(throwScope);
5862 UNUSED_PARAM(callFrame);
5863 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardKeysToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
5864}
5865
5866JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_keys, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5867{
5868 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_keysBody>(*lexicalGlobalObject, *callFrame, "keys");
5869}
5870
5871static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_valuesBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5872{
5873 auto& vm = JSC::getVM(lexicalGlobalObject);
5874 auto throwScope = DECLARE_THROW_SCOPE(vm);
5875 UNUSED_PARAM(throwScope);
5876 UNUSED_PARAM(callFrame);
5877 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardValuesToMapLike(*lexicalGlobalObject, *callFrame, *castedThis))));
5878}
5879
5880JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_values, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5881{
5882 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_valuesBody>(*lexicalGlobalObject, *callFrame, "values");
5883}
5884
5885static inline JSC::EncodedJSValue jsRTCStatsReportPrototypeFunction_forEachBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSRTCStatsReport>::ClassParameter castedThis)
5886{
5887 auto& vm = JSC::getVM(lexicalGlobalObject);
5888 auto throwScope = DECLARE_THROW_SCOPE(vm);
5889 UNUSED_PARAM(throwScope);
5890 UNUSED_PARAM(callFrame);
5891 if (UNLIKELY(callFrame->argumentCount() < 1))
5892 return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
5893 EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
5894 auto callback = convert<IDLAny>(*lexicalGlobalObject, argument0.value());
5895 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
5896 RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLAny>(*lexicalGlobalObject, throwScope, forwardForEachToMapLike(*lexicalGlobalObject, *callFrame, *castedThis, WTFMove(callback)))));
5897}
5898
5899JSC_DEFINE_HOST_FUNCTION(jsRTCStatsReportPrototypeFunction_forEach, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
5900{
5901 return IDLOperation<JSRTCStatsReport>::call<jsRTCStatsReportPrototypeFunction_forEachBody>(*lexicalGlobalObject, *callFrame, "forEach");
5902}
5903
5904JSC::IsoSubspace* JSRTCStatsReport::subspaceForImpl(JSC::VM& vm)
5905{
5906 auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
5907 auto& spaces = clientData.subspaces();
5908 if (auto* space = spaces.m_subspaceForRTCStatsReport.get())
5909 return space;
5910 static_assert(std::is_base_of_v<JSC::JSDestructibleObject, JSRTCStatsReport> || !JSRTCStatsReport::needsDestruction);
5911 if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, JSRTCStatsReport>)
5912 spaces.m_subspaceForRTCStatsReport = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), JSRTCStatsReport);
5913 else
5914 spaces.m_subspaceForRTCStatsReport = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), JSRTCStatsReport);
5915 auto* space = spaces.m_subspaceForRTCStatsReport.get();
5916IGNORE_WARNINGS_BEGIN("unreachable-code")
5917IGNORE_WARNINGS_BEGIN("tautological-compare")
5918 void (*myVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSRTCStatsReport::visitOutputConstraints;
5919 void (*jsCellVisitOutputConstraint)(JSC::JSCell*, JSC::SlotVisitor&) = JSC::JSCell::visitOutputConstraints;
5920 if (myVisitOutputConstraint != jsCellVisitOutputConstraint)
5921 clientData.outputConstraintSpaces().append(space);
5922IGNORE_WARNINGS_END
5923IGNORE_WARNINGS_END
5924 return space;
5925}
5926
5927void JSRTCStatsReport::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
5928{
5929 auto* thisObject = jsCast<JSRTCStatsReport*>(cell);
5930 analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
5931 if (thisObject->scriptExecutionContext())
5932 analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
5933 Base::analyzeHeap(cell, analyzer);
5934}
5935
5936bool JSRTCStatsReportOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason)
5937{
5938 UNUSED_PARAM(handle);
5939 UNUSED_PARAM(visitor);
5940 UNUSED_PARAM(reason);
5941 return false;
5942}
5943
5944void JSRTCStatsReportOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
5945{
5946 auto* jsRTCStatsReport = static_cast<JSRTCStatsReport*>(handle.slot()->asCell());
5947 auto& world = *static_cast<DOMWrapperWorld*>(context);
5948 uncacheWrapper(world, &jsRTCStatsReport->wrapped(), jsRTCStatsReport);
5949}
5950
5951JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<RTCStatsReport>&& impl)
5952{
5953 // If you hit this failure the interface definition has the ImplementationLacksVTable
5954 // attribute. You should remove that attribute. If the class has subclasses
5955 // that may be passed through this toJS() function you should use the SkipVTableValidation
5956 // attribute to RTCStatsReport.
5957 static_assert(!std::is_polymorphic<RTCStatsReport>::value, "RTCStatsReport is polymorphic but the IDL claims it is not");
5958 return createWrapper<RTCStatsReport>(globalObject, WTFMove(impl));
5959}
5960
5961JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RTCStatsReport& impl)
5962{
5963 return wrap(lexicalGlobalObject, globalObject, impl);
5964}
5965
5966RTCStatsReport* JSRTCStatsReport::toWrapped(JSC::VM& vm, JSC::JSValue value)
5967{
5968 if (auto* wrapper = jsDynamicCast<JSRTCStatsReport*>(vm, value))
5969 return &wrapper->wrapped();
5970 return nullptr;
5971}
5972
5973}
5974
5975#endif // ENABLE(WEB_RTC)
5976